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 (71) |
Complexity: 16 |
Complexity Density: 0.29 |
|
31 |
|
public class FormulaCheckerTermTest 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 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
53 |
1
|
public void testTermPositive01() throws Exception {... |
54 |
1
|
final Element ele = BasicParser.createElement( |
55 |
|
"<CLASS>" + |
56 |
|
" <VAR id=\"x\" />" + |
57 |
|
" <AND>" + |
58 |
|
" <PREDCON id=\"in\">" + |
59 |
|
" <VAR id=\"x\" />" + |
60 |
|
" <VAR id=\"a\" />" + |
61 |
|
" </PREDCON>" + |
62 |
|
" <PREDCON id=\"in\">" + |
63 |
|
" <VAR id=\"x\" />" + |
64 |
|
" <VAR id=\"b\" />" + |
65 |
|
" </PREDCON>" + |
66 |
|
" </AND>" + |
67 |
|
"</CLASS>"); |
68 |
|
|
69 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
70 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
@throws |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
80 |
1
|
public void testTermPositive02() throws Exception {... |
81 |
1
|
final Element ele = BasicParser.createElement( |
82 |
|
"<FUNVAR id=\"f\">" + |
83 |
|
" <VAR id=\"x\" />" + |
84 |
|
" <VAR id=\"y\" />" + |
85 |
|
" <VAR id=\"x\" />" + |
86 |
|
"</FUNVAR>"); |
87 |
|
|
88 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
89 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
@throws |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
99 |
1
|
public void testTermPositive03() throws Exception {... |
100 |
1
|
final Element ele = BasicParser.createElement( |
101 |
|
"<FUNCON id=\"power\">" + |
102 |
|
" <FUNCON id=\"union\">" + |
103 |
|
" <VAR id=\"x\" />" + |
104 |
|
" <VAR id=\"y\" />" + |
105 |
|
" </FUNCON>" + |
106 |
|
"</FUNCON>"); |
107 |
|
|
108 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
109 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@throws |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
119 |
1
|
public void testTermPositive04() throws Exception {... |
120 |
1
|
final Element ele = BasicParser.createElement( |
121 |
|
"<VAR id=\"x\" />"); |
122 |
|
|
123 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
124 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
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 testTermNegative01() throws Exception {... |
135 |
1
|
final Element ele = BasicParser.createElement( |
136 |
|
"<AND><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></AND>"); |
137 |
|
|
138 |
1
|
LogicalCheckExceptionList list = |
139 |
|
checker.checkTerm(ele, context, getChecker()); |
140 |
1
|
assertEquals(1, list.size()); |
141 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@throws |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
151 |
1
|
public void testTermNegative02() throws Exception {... |
152 |
1
|
final Element ele = BasicParser.createElement( |
153 |
|
"<UNKNOWN><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></UNKNOWN>"); |
154 |
|
|
155 |
1
|
LogicalCheckExceptionList list = |
156 |
|
checker.checkTerm(ele, context, getChecker()); |
157 |
1
|
assertEquals(1, list.size()); |
158 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
@throws |
167 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
168 |
1
|
public void testTermNegative03() throws Exception {... |
169 |
1
|
final Element ele = BasicParser.createElement( |
170 |
|
"<OR><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></OR>"); |
171 |
|
|
172 |
1
|
LogicalCheckExceptionList list = |
173 |
|
checker.checkTerm(ele, context, getChecker()); |
174 |
1
|
assertEquals(1, list.size()); |
175 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
176 |
|
} |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
@throws |
184 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
185 |
1
|
public void testTermNegative04() throws Exception {... |
186 |
1
|
final Element ele = BasicParser.createElement( |
187 |
|
"<IMPL><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></IMPL>"); |
188 |
|
|
189 |
1
|
LogicalCheckExceptionList list = |
190 |
|
checker.checkTerm(ele, context, getChecker()); |
191 |
1
|
assertEquals(1, list.size()); |
192 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
193 |
|
} |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
@throws |
201 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
202 |
1
|
public void testTermNegative05() throws Exception {... |
203 |
1
|
final Element ele = BasicParser.createElement( |
204 |
|
"<EQUI><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></EQUI>"); |
205 |
|
|
206 |
1
|
LogicalCheckExceptionList list = |
207 |
|
checker.checkTerm(ele, context, getChecker()); |
208 |
1
|
assertEquals(1, list.size()); |
209 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
210 |
|
} |
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
@throws |
218 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
219 |
1
|
public void testTermNegative06() throws Exception {... |
220 |
1
|
final Element ele = BasicParser.createElement( |
221 |
|
"<NOT><PREDVAR id=\"A\"/></NOT>"); |
222 |
|
|
223 |
1
|
LogicalCheckExceptionList list = |
224 |
|
checker.checkTerm(ele, context, getChecker()); |
225 |
1
|
assertEquals(1, list.size()); |
226 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
227 |
|
} |
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
@throws |
235 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
236 |
1
|
public void testTermNegative07() throws Exception {... |
237 |
1
|
final Element ele = BasicParser.createElement( |
238 |
|
"<PREDVAR id=\"A\"/>"); |
239 |
|
|
240 |
1
|
LogicalCheckExceptionList list = |
241 |
|
checker.checkTerm(ele, context, getChecker()); |
242 |
1
|
assertEquals(1, list.size()); |
243 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
244 |
|
} |
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
@throws |
252 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
253 |
1
|
public void testTermNegative08() throws Exception {... |
254 |
1
|
final Element ele = BasicParser.createElement( |
255 |
|
"<FORALL><VAR id=\"x\" /><PREDVAR id=\"A\"/></FORALL>"); |
256 |
|
|
257 |
1
|
LogicalCheckExceptionList list = |
258 |
|
checker.checkTerm(ele, context, getChecker()); |
259 |
1
|
assertEquals(1, list.size()); |
260 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
261 |
|
} |
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
@throws |
269 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
270 |
1
|
public void testTermNegative09() throws Exception {... |
271 |
1
|
final Element ele = BasicParser.createElement( |
272 |
|
"<EXISTS><VAR id=\"x\" /><PREDVAR id=\"A\"/></EXISTS>"); |
273 |
|
|
274 |
1
|
LogicalCheckExceptionList list = |
275 |
|
checker.checkTerm(ele, context, getChecker()); |
276 |
1
|
assertEquals(1, list.size()); |
277 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
278 |
|
} |
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
@throws |
286 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
287 |
1
|
public void testTermNegative10() throws Exception {... |
288 |
1
|
final Element ele = BasicParser.createElement( |
289 |
|
"<EXISTSU><VAR id=\"x\" /><PREDVAR id=\"A\"/></EXISTSU>"); |
290 |
|
|
291 |
1
|
LogicalCheckExceptionList list = |
292 |
|
checker.checkTerm(ele, context, getChecker()); |
293 |
1
|
assertEquals(1, list.size()); |
294 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
295 |
|
} |
296 |
|
|
297 |
|
} |