1 |
|
package org.qedeq.kernel.bo.parser; |
2 |
|
|
3 |
|
import java.io.File; |
4 |
|
import java.util.List; |
5 |
|
|
6 |
|
import org.qedeq.base.io.TextInput; |
7 |
|
import org.qedeq.kernel.xml.handler.parser.LoadXmlOperatorListUtility; |
8 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (69) |
Complexity: 34 |
Complexity Density: 0,97 |
|
9 |
|
public class SimpleMathParserTest extends AbstractParserTest { |
10 |
|
|
11 |
|
private static String[][] test = new String[][] { |
12 |
|
{ |
13 |
|
"A & B | C", |
14 |
|
"OR(AND(A, B), C)" |
15 |
|
}, { |
16 |
|
"A | B & C", |
17 |
|
"OR(A, AND(B, C))" |
18 |
|
}, { |
19 |
|
"A & B & C & D", |
20 |
|
"AND(A, B, C, D)" |
21 |
|
}, { |
22 |
|
"(A & B) & (C & D)", |
23 |
|
"AND(AND(A, B), AND(C, D))" |
24 |
|
}, { |
25 |
|
"((A & B) & C) & D", |
26 |
|
"AND(AND(AND(A, B), C), D)" |
27 |
|
}, { |
28 |
|
"A & (B & (C & D))", |
29 |
|
"AND(A, AND(B, AND(C, D)))" |
30 |
|
}, { |
31 |
|
"(((((A)))))", |
32 |
|
"A" |
33 |
|
}, { |
34 |
|
"~A", |
35 |
|
"NOT(A)" |
36 |
|
}, { |
37 |
|
"~~A", |
38 |
|
"NOT(NOT(A))" |
39 |
|
}, { |
40 |
|
"A => B", |
41 |
|
"IMPL(A, B)" |
42 |
|
}, { |
43 |
|
"A => B | C", |
44 |
|
"IMPL(A, OR(B, C))" |
45 |
|
}, { |
46 |
|
"A | B => C", |
47 |
|
"IMPL(OR(A, B), C)" |
48 |
|
}, { |
49 |
|
"A | B => A & B", |
50 |
|
"IMPL(OR(A, B), AND(A, B))" |
51 |
|
}, { |
52 |
|
"(A => B) => C", |
53 |
|
"IMPL(IMPL(A, B), C)" |
54 |
|
}, { |
55 |
|
"A & B => B & D", |
56 |
|
"IMPL(AND(A, B), AND(B, D))" |
57 |
|
}, { |
58 |
|
"A & B | C => B | D & E", |
59 |
|
"IMPL(OR(AND(A, B), C), OR(B, AND(D, E)))" |
60 |
|
}, { |
61 |
|
"A <=> B", |
62 |
|
"EQUI(A, B)" |
63 |
|
}, { |
64 |
|
"A <=> B | C", |
65 |
|
"EQUI(A, OR(B, C))" |
66 |
|
}, { |
67 |
|
"A | B <=> C", |
68 |
|
"EQUI(OR(A, B), C)" |
69 |
|
}, { |
70 |
|
"A | B <=> A & B", |
71 |
|
"EQUI(OR(A, B), AND(A, B))" |
72 |
|
}, { |
73 |
|
"A <=> B <=> C", |
74 |
|
"EQUI(A, B, C)" |
75 |
|
}, { |
76 |
|
"all x A & B \n", |
77 |
|
"ALL(x, AND(A, B))" |
78 |
|
}, { |
79 |
|
"all x x = y y", |
80 |
|
"ALL(x, EQUAL(x, y), y)" |
81 |
|
}, { |
82 |
|
"x & y | z | a & -(b | c | d & k) & v", |
83 |
|
"OR(AND(x, y), z, AND(a, NOT(OR(b, c, AND(d, k))), v))" |
84 |
|
}, { |
85 |
|
"x & y | z | a & -(b | c | d & k) & v => exists y z & a <=> GO <=> GI\n", |
86 |
|
"IMPL(OR(AND(x, y), z, AND(a, NOT(OR(b, c, AND(d, k))), v)), EXISTS(y, EQUI(AND(z, a), GO, GI)))" |
87 |
|
}, { |
88 |
|
"{x, y, z}", |
89 |
|
"SET(x, y, z)" |
90 |
|
}, { |
91 |
|
"{x}", |
92 |
|
"SET(x)" |
93 |
|
}, { |
94 |
|
"{}", |
95 |
|
"SET()" |
96 |
|
}, { |
97 |
|
"{x : y}", |
98 |
|
"SETPROP(x, y)" |
99 |
|
} |
100 |
|
|
101 |
|
}; |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
30
|
public SimpleMathParserTest(String arg0) {... |
104 |
30
|
super(arg0); |
105 |
|
} |
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
30
|
protected void setUp() throws Exception {... |
108 |
30
|
super.setUp(); |
109 |
|
} |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
111 |
30
|
protected void tearDown() throws Exception {... |
112 |
30
|
super.tearDown(); |
113 |
|
} |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
146
|
protected String[][] getTest() {... |
116 |
146
|
return test; |
117 |
|
} |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
119 |
30
|
protected MathParser createParser(final TextInput input) throws Exception {... |
120 |
30
|
final List operators = LoadXmlOperatorListUtility.getOperatorList(new File(getIndir(), |
121 |
|
"parser/simpleMathOperators.xml")); |
122 |
30
|
return new SimpleMathParser(input, operators); |
123 |
|
} |
124 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
125 |
1
|
public void testReadMaximalTerm00() throws Exception {... |
126 |
1
|
internalTest(0); |
127 |
|
} |
128 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
129 |
1
|
public void testReadMaximalTerm01() throws Exception {... |
130 |
1
|
internalTest(1); |
131 |
|
} |
132 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
133 |
1
|
public void testReadMaximalTerm02() throws Exception {... |
134 |
1
|
internalTest(2); |
135 |
|
} |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
137 |
1
|
public void testReadMaximalTerm03() throws Exception {... |
138 |
1
|
internalTest(3); |
139 |
|
} |
140 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
141 |
1
|
public void testReadMaximalTerm04() throws Exception {... |
142 |
1
|
internalTest(4); |
143 |
|
} |
144 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
145 |
1
|
public void testReadMaximalTerm05() throws Exception {... |
146 |
1
|
internalTest(5); |
147 |
|
} |
148 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
149 |
1
|
public void testReadMaximalTerm06() throws Exception {... |
150 |
1
|
internalTest(6); |
151 |
|
} |
152 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
153 |
1
|
public void testReadMaximalTerm07() throws Exception {... |
154 |
1
|
internalTest(7); |
155 |
|
} |
156 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
157 |
1
|
public void testReadMaximalTerm08() throws Exception {... |
158 |
1
|
internalTest(8); |
159 |
|
} |
160 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
161 |
1
|
public void testReadMaximalTerm09() throws Exception {... |
162 |
1
|
internalTest(9); |
163 |
|
} |
164 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
165 |
1
|
public void testReadMaximalTerm10() throws Exception {... |
166 |
1
|
internalTest(10); |
167 |
|
} |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
169 |
1
|
public void testReadMaximalTerm11() throws Exception {... |
170 |
1
|
internalTest(11); |
171 |
|
} |
172 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
173 |
1
|
public void testReadMaximalTerm12() throws Exception {... |
174 |
1
|
internalTest(12); |
175 |
|
} |
176 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
177 |
1
|
public void testReadMaximalTerm13() throws Exception {... |
178 |
1
|
internalTest(13); |
179 |
|
} |
180 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
181 |
1
|
public void testReadMaximalTerm14() throws Exception {... |
182 |
1
|
internalTest(14); |
183 |
|
} |
184 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
185 |
1
|
public void testReadMaximalTerm15() throws Exception {... |
186 |
1
|
internalTest(15); |
187 |
|
} |
188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
189 |
1
|
public void testReadMaximalTerm16() throws Exception {... |
190 |
1
|
internalTest(16); |
191 |
|
} |
192 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
193 |
1
|
public void testReadMaximalTerm17() throws Exception {... |
194 |
1
|
internalTest(17); |
195 |
|
} |
196 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
197 |
1
|
public void testReadMaximalTerm18() throws Exception {... |
198 |
1
|
internalTest(18); |
199 |
|
} |
200 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
201 |
1
|
public void testReadMaximalTerm19() throws Exception {... |
202 |
1
|
internalTest(19); |
203 |
|
} |
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
205 |
1
|
public void testReadMaximalTerm20() throws Exception {... |
206 |
1
|
internalTest(20); |
207 |
|
} |
208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
209 |
1
|
public void testReadMaximalTerm21() throws Exception {... |
210 |
1
|
internalTest(21); |
211 |
|
} |
212 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
213 |
1
|
public void testReadMaximalTerm22() throws Exception {... |
214 |
1
|
internalTest(22); |
215 |
|
} |
216 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
217 |
1
|
public void testReadMaximalTerm23() throws Exception {... |
218 |
1
|
internalTest(23); |
219 |
|
} |
220 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
221 |
1
|
public void testReadMaximalTerm24() throws Exception {... |
222 |
1
|
internalTest(24); |
223 |
|
} |
224 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
225 |
1
|
public void testReadMaximalTerm25() throws Exception {... |
226 |
1
|
internalTest(25); |
227 |
|
} |
228 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
229 |
1
|
public void testReadMaximalTerm26() throws Exception {... |
230 |
1
|
internalTest(26); |
231 |
|
} |
232 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
233 |
1
|
public void testReadMaximalTerm27() throws Exception {... |
234 |
1
|
internalTest(27); |
235 |
|
} |
236 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
237 |
1
|
public void testReadMaximalTerm28() throws Exception {... |
238 |
1
|
internalTest(28); |
239 |
|
} |
240 |
|
|
241 |
|
} |