1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.bo.logic.wf; |
17 |
|
|
18 |
|
import org.qedeq.kernel.bo.logic.common.FormulaChecker; |
19 |
|
import org.qedeq.kernel.bo.logic.common.LogicalCheckExceptionList; |
20 |
|
import org.qedeq.kernel.se.base.list.Element; |
21 |
|
import org.qedeq.kernel.se.common.DefaultModuleAddress; |
22 |
|
import org.qedeq.kernel.se.common.ModuleContext; |
23 |
|
import org.qedeq.kernel.xml.parser.BasicParser; |
24 |
|
|
25 |
|
|
26 |
|
@link |
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (75) |
Complexity: 16 |
Complexity Density: 0.27 |
|
31 |
|
public class FormulaCheckerFunctionTermTest extends AbstractFormulaChecker { |
32 |
|
|
33 |
|
private ModuleContext context; |
34 |
|
|
35 |
|
private FormulaChecker checker; |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
37 |
14
|
protected void setUp() throws Exception {... |
38 |
14
|
context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()"); |
39 |
14
|
checker = new FormulaCheckerImpl(); |
40 |
|
} |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
42 |
14
|
protected void tearDown() throws Exception {... |
43 |
14
|
context = null; |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@throws |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
53 |
1
|
public void testFunctionTermPositive01() throws Exception {... |
54 |
1
|
final Element ele = BasicParser.createElement( |
55 |
|
"<FUNVAR id=\"f\">" + |
56 |
|
" <VAR id=\"x\" />" + |
57 |
|
"</FUNVAR>"); |
58 |
|
|
59 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
60 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
61 |
1
|
assertFalse(checker.checkTerm(ele, context, getCheckerWithoutClass()).hasErrors()); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
@throws |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
71 |
1
|
public void testFunctionTermPositive02() throws Exception {... |
72 |
1
|
final Element ele = BasicParser.createElement("<FUNCON ref=\"empty\"/>"); |
73 |
|
|
74 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
75 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
76 |
1
|
assertFalse(checker.checkTerm(ele, context, getCheckerWithoutClass()).hasErrors()); |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
@throws |
85 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
86 |
1
|
public void testFunctionTermNegative01() throws Exception {... |
87 |
1
|
final Element ele = BasicParser.createElement("<FUNVAR />"); |
88 |
|
|
89 |
1
|
LogicalCheckExceptionList list = |
90 |
|
checker.checkTerm(ele, context, getChecker()); |
91 |
1
|
assertEquals(1, list.size()); |
92 |
1
|
assertEquals(30740, list.get(0).getErrorCode()); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@throws |
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
102 |
1
|
public void testFunctionTermNegative01b() throws Exception {... |
103 |
1
|
final Element ele = BasicParser.createElement("<FUNVAR id=\"f\"/>"); |
104 |
|
|
105 |
1
|
LogicalCheckExceptionList list = |
106 |
|
checker.checkTerm(ele, context, getChecker()); |
107 |
1
|
assertEquals(1, list.size()); |
108 |
1
|
assertEquals(30740, list.get(0).getErrorCode()); |
109 |
|
} |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
@throws |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
118 |
1
|
public void testFunctionTermNegative02() throws Exception {... |
119 |
1
|
final Element ele = BasicParser.createElement("<FUNCON />"); |
120 |
|
|
121 |
1
|
LogicalCheckExceptionList list = |
122 |
|
checker.checkTerm(ele, context, getChecker()); |
123 |
1
|
assertEquals(1, list.size()); |
124 |
1
|
assertEquals(30720, list.get(0).getErrorCode()); |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
@throws |
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
134 |
1
|
public void testFunctionTermNegative09() throws Exception {... |
135 |
1
|
final Element ele = BasicParser.createElement( |
136 |
|
"<FUNVAR>" + |
137 |
|
" <VAR id=\"x\" /> <VAR id=\"x\" />" + |
138 |
|
"</FUNVAR>"); |
139 |
|
|
140 |
1
|
LogicalCheckExceptionList list = |
141 |
|
checker.checkTerm(ele, context, getChecker()); |
142 |
1
|
assertEquals(1, list.size()); |
143 |
1
|
assertEquals(30730, list.get(0).getErrorCode()); |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
@throws |
153 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
154 |
1
|
public void testFunctionTermNegative10() throws Exception {... |
155 |
1
|
final Element ele = BasicParser.createElement("<FUNCON > <VAR id=\"x\" /> </FUNCON>"); |
156 |
|
|
157 |
1
|
LogicalCheckExceptionList list = |
158 |
|
checker.checkTerm(ele, context, getChecker()); |
159 |
1
|
assertEquals(1, list.size()); |
160 |
1
|
assertEquals(30730, list.get(0).getErrorCode()); |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
@throws |
170 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
171 |
1
|
public void testFunctionTermNegative13() throws Exception {... |
172 |
1
|
final Element ele = BasicParser.createElement("<FUNVAR> <A/> <A/></FUNVAR>"); |
173 |
|
|
174 |
1
|
LogicalCheckExceptionList list = |
175 |
|
checker.checkTerm(ele, context, getChecker()); |
176 |
1
|
assertEquals(1, list.size()); |
177 |
1
|
assertEquals(30730, list.get(0).getErrorCode()); |
178 |
|
} |
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
@throws |
186 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
187 |
1
|
public void testFunctionTermNegative14() throws Exception {... |
188 |
1
|
final Element ele = BasicParser.createElement("<FUNCON> <A/> </FUNCON>"); |
189 |
|
|
190 |
1
|
LogicalCheckExceptionList list = |
191 |
|
checker.checkTerm(ele, context, getChecker()); |
192 |
1
|
assertEquals(1, list.size()); |
193 |
1
|
assertEquals(30730, list.get(0).getErrorCode()); |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
@throws |
202 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
203 |
1
|
public void testFunctionTermNegative15() throws Exception {... |
204 |
1
|
final Element ele = BasicParser.createElement( |
205 |
|
"<FUNVAR id=\"f\">" |
206 |
|
+ "<VAR id=\"x\"/>" |
207 |
|
+ "<CLASS> <VAR id=\"x\"/> <PREDVAR id=\"\\phi\" /> </CLASS>" |
208 |
|
+ "</FUNVAR>"); |
209 |
|
|
210 |
1
|
LogicalCheckExceptionList list = |
211 |
|
checker.checkTerm(ele, context, getChecker()); |
212 |
1
|
assertEquals(1, list.size()); |
213 |
1
|
assertEquals(30770, list.get(0).getErrorCode()); |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
@throws |
222 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
223 |
1
|
public void testFunctionTermNegative16() throws Exception {... |
224 |
1
|
final Element ele = BasicParser.createElement( |
225 |
|
"<FUNCON ref=\"union\">" |
226 |
|
+ "<VAR id=\"x\"/>" |
227 |
|
+ "<CLASS> <VAR id=\"x\"/> <PREDVAR id=\"\\phi\" /> </CLASS>" |
228 |
|
+ "</FUNCON>"); |
229 |
|
|
230 |
1
|
LogicalCheckExceptionList list = |
231 |
|
checker.checkTerm(ele, context, getChecker()); |
232 |
1
|
assertEquals(1, list.size()); |
233 |
1
|
assertEquals(30770, list.get(0).getErrorCode()); |
234 |
|
} |
235 |
|
|
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
@throws |
242 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
243 |
1
|
public void testFunctionTermNegative19() throws Exception {... |
244 |
1
|
final Element ele = BasicParser.createElement( |
245 |
|
"<FUNVAR id=\"f\">" |
246 |
|
+ "<CLASS> <VAR id=\"x\"/> <PREDVAR id=\"\\phi\" /> </CLASS>" |
247 |
|
+ "<VAR id=\"x\"/>" |
248 |
|
+ "</FUNVAR>"); |
249 |
|
|
250 |
1
|
LogicalCheckExceptionList list = |
251 |
|
checker.checkTerm(ele, context, getChecker()); |
252 |
1
|
assertEquals(1, list.size()); |
253 |
1
|
assertEquals(30780, list.get(0).getErrorCode()); |
254 |
|
} |
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
@throws |
262 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
263 |
1
|
public void testFunctionTermNegative20() throws Exception {... |
264 |
1
|
final Element ele = BasicParser.createElement( |
265 |
|
"<FUNCON id=\"union\">" |
266 |
|
+ "<CLASS> <VAR id=\"x\"/> <PREDVAR id=\"\\phi\" /> </CLASS>" |
267 |
|
+ "<VAR id=\"x\"/>" |
268 |
|
+ "</FUNCON>"); |
269 |
|
|
270 |
1
|
LogicalCheckExceptionList list = |
271 |
|
checker.checkTerm(ele, context, getChecker()); |
272 |
1
|
assertEquals(1, list.size()); |
273 |
1
|
assertEquals(30780, list.get(0).getErrorCode()); |
274 |
|
} |
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
@throws |
282 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
283 |
1
|
public void testFunctionTermNegative22() throws Exception {... |
284 |
1
|
final Element ele = BasicParser.createElement( |
285 |
|
"<FUNCON id=\"F\" />"); |
286 |
|
|
287 |
1
|
LogicalCheckExceptionList list = |
288 |
|
checker.checkTerm(ele, context, getChecker()); |
289 |
1
|
assertEquals(1, list.size()); |
290 |
1
|
assertEquals(30690, list.get(0).getErrorCode()); |
291 |
|
} |
292 |
|
|
293 |
|
} |