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