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 (45) |
Complexity: 10 |
Complexity Density: 0.29 |
|
31 |
|
public class FormulaCheckerClassTermTest extends AbstractFormulaChecker { |
32 |
|
|
33 |
|
|
34 |
|
private ModuleContext context; |
35 |
|
|
36 |
|
private FormulaChecker checker; |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
38 |
8
|
protected void setUp() throws Exception {... |
39 |
8
|
context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()"); |
40 |
8
|
checker = new FormulaCheckerImpl(); |
41 |
|
} |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
8
|
protected void tearDown() throws Exception {... |
44 |
8
|
context = null; |
45 |
|
} |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
@throws |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
54 |
1
|
public void testClassTermPositive01() throws Exception {... |
55 |
1
|
final Element ele = BasicParser.createElement( |
56 |
|
"<CLASS><VAR id=\"x\" /><PREDVAR id=\"A\" /></CLASS>"); |
57 |
|
|
58 |
|
|
59 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
60 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@throws |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
70 |
1
|
public void testClassTermPositive02() throws Exception {... |
71 |
1
|
final Element ele = BasicParser.createElement( |
72 |
|
"<CLASS>" + |
73 |
|
" <VAR id=\"x\" />" + |
74 |
|
" <PREDVAR id=\"phi\">" + |
75 |
|
" <VAR id=\"y\" />" + |
76 |
|
" <VAR id=\"x\" />" + |
77 |
|
" </PREDVAR>" + |
78 |
|
"</CLASS>"); |
79 |
|
|
80 |
|
|
81 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
82 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
@throws |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
92 |
1
|
public void testClassTermPositive03() throws Exception {... |
93 |
1
|
final Element ele = BasicParser.createElement( |
94 |
|
"<CLASS>" + |
95 |
|
" <VAR id=\"x\" />" + |
96 |
|
" <FORALL>" + |
97 |
|
" <VAR id=\"y\" />" + |
98 |
|
" <PREDVAR id=\"phi\">" + |
99 |
|
" <VAR id=\"y\" />" + |
100 |
|
" <VAR id=\"x\" />" + |
101 |
|
" </PREDVAR>" + |
102 |
|
" </FORALL>" + |
103 |
|
"</CLASS>"); |
104 |
|
|
105 |
|
|
106 |
1
|
assertFalse(checker.checkTerm(ele, context).hasErrors()); |
107 |
1
|
assertFalse(checker.checkTerm(ele, context, getChecker()).hasErrors()); |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@throws |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
117 |
1
|
public void testClassTermNegative01() throws Exception {... |
118 |
1
|
final Element ele = BasicParser.createElement( |
119 |
|
"<CLASS>" + |
120 |
|
" <VAR id=\"x\" />" + |
121 |
|
" <PREDVAR id=\"phi\">" + |
122 |
|
" <VAR id=\"y\" />" + |
123 |
|
" <VAR id=\"x\" />" + |
124 |
|
" </PREDVAR>" + |
125 |
|
" <PREDVAR id=\"phi\">" + |
126 |
|
" <VAR id=\"y\" />" + |
127 |
|
" <VAR id=\"x\" />" + |
128 |
|
" </PREDVAR>" + |
129 |
|
"</CLASS>"); |
130 |
|
|
131 |
|
|
132 |
1
|
LogicalCheckExceptionList list = |
133 |
|
checker.checkTerm(ele, context, getChecker()); |
134 |
1
|
assertEquals(1, list.size()); |
135 |
1
|
assertEquals(30760, list.get(0).getErrorCode()); |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
@throws |
144 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
145 |
1
|
public void testClassTermNegative02() throws Exception {... |
146 |
1
|
final Element ele = BasicParser.createElement( |
147 |
|
"<CLASS>" + |
148 |
|
" <VAR id=\"x\" />" + |
149 |
|
"</CLASS>"); |
150 |
|
|
151 |
1
|
LogicalCheckExceptionList list = |
152 |
|
checker.checkTerm(ele, context, getChecker()); |
153 |
1
|
assertEquals(1, list.size()); |
154 |
1
|
assertEquals(30760, list.get(0).getErrorCode()); |
155 |
|
} |
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
@throws |
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
164 |
1
|
public void testClassTermNegative03() throws Exception {... |
165 |
1
|
final Element ele = BasicParser.createElement( |
166 |
|
"<CLASS>" + |
167 |
|
" <PREDVAR id=\"phi\">" + |
168 |
|
" <VAR id=\"y\" />" + |
169 |
|
" <VAR id=\"x\" />" + |
170 |
|
" </PREDVAR>" + |
171 |
|
" <PREDVAR id=\"phi\">" + |
172 |
|
" <VAR id=\"y\" />" + |
173 |
|
" <VAR id=\"x\" />" + |
174 |
|
" </PREDVAR>" + |
175 |
|
"</CLASS>"); |
176 |
|
|
177 |
1
|
LogicalCheckExceptionList list = |
178 |
|
checker.checkTerm(ele, context, getChecker()); |
179 |
1
|
assertEquals(1, list.size()); |
180 |
1
|
assertEquals(30540, list.get(0).getErrorCode()); |
181 |
|
} |
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
@throws |
189 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
190 |
1
|
public void testClassTermNegative04() throws Exception {... |
191 |
1
|
final Element ele = BasicParser.createElement( |
192 |
|
"<CLASS>" + |
193 |
|
" <VAR id=\"x\" />" + |
194 |
|
" <FORALL>" + |
195 |
|
" <VAR id=\"x\" />" + |
196 |
|
" <PREDVAR id=\"phi\">" + |
197 |
|
" <VAR id=\"y\" />" + |
198 |
|
" <VAR id=\"x\" />" + |
199 |
|
" </PREDVAR>" + |
200 |
|
" </FORALL>" + |
201 |
|
"</CLASS>"); |
202 |
|
|
203 |
1
|
LogicalCheckExceptionList list = |
204 |
|
checker.checkTerm(ele, context, getChecker()); |
205 |
1
|
assertEquals(1, list.size()); |
206 |
1
|
assertEquals(30550, list.get(0).getErrorCode()); |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
@throws |
216 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
217 |
1
|
public void testClassTermNegative05() throws Exception {... |
218 |
1
|
final Element ele = BasicParser.createElement( |
219 |
|
"<CLASS>" + |
220 |
|
" <VAR id=\"x\" />" + |
221 |
|
" <FORALL>" + |
222 |
|
" <VAR id=\"y\" />" + |
223 |
|
" <PREDVAR id=\"phi\">" + |
224 |
|
" <VAR id=\"y\" />" + |
225 |
|
" <VAR id=\"x\" />" + |
226 |
|
" </PREDVAR>" + |
227 |
|
" </FORALL>" + |
228 |
|
"</CLASS>"); |
229 |
|
|
230 |
1
|
LogicalCheckExceptionList list = |
231 |
|
checker.checkTerm(ele, context, getChecker()); |
232 |
1
|
assertTrue(!list.hasErrors()); |
233 |
1
|
assertEquals(0, list.size()); |
234 |
1
|
list = |
235 |
|
checker.checkTerm(ele, context, getCheckerWithoutClass()); |
236 |
1
|
assertEquals(1, list.size()); |
237 |
1
|
assertEquals(30680, list.get(0).getErrorCode()); |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
} |