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.DummyInternalKernelServices; |
8 |
|
import org.qedeq.kernel.xml.handler.parser.LoadXmlOperatorListUtility; |
9 |
|
|
|
|
| 94.3% |
Uncovered Elements: 2 (35) |
Complexity: 16 |
Complexity Density: 0.84 |
|
10 |
|
public class LatexMathParserTest extends AbstractParserTestCase { |
11 |
|
|
12 |
|
private static String[][] test = new String[][] { |
13 |
|
{ |
14 |
|
"(A \\lor A) \\impl A", |
15 |
|
"IMPL(OR(A(), A()), A())" |
16 |
|
}, { |
17 |
|
"A \\impl (A \\lor B)", |
18 |
|
"IMPL(A(), OR(A(), B()))" |
19 |
|
}, { |
20 |
|
"(A \\lor B) \\impl (B \\lor A)", |
21 |
|
"IMPL(OR(A(), B()), OR(B(), A()))" |
22 |
|
}, { |
23 |
|
"(A \\impl B) \\impl ((C \\lor A) \\impl (C \\lor B))", |
24 |
|
"IMPL(IMPL(A(), B()), IMPL(OR(C(), A()), OR(C(), B())))" |
25 |
|
}, { |
26 |
|
"(\\forall x~\\phi(x)) \\impl \\phi(y)", |
27 |
|
"IMPL(ALL(x(), PREDVAR_1(x())), PREDVAR_1(y()))" |
28 |
|
}, { |
29 |
|
"\\phi(y) \\impl (\\exists x~\\phi(x))", |
30 |
|
"IMPL(PREDVAR_1(y()), EXISTS(x(), PREDVAR_1(x())))" |
31 |
|
}, { |
32 |
|
"$$\\alpha \\land \\beta \\ \\defp \\ \\neg(\\neg\\alpha \\lor \\neg\\beta)$$", |
33 |
|
"DEFP(AND(PREDVAR_3(), PREDVAR_4()), NOT(OR(NOT(PREDVAR_3()), NOT(PREDVAR_4()))))" |
34 |
|
}, { |
35 |
|
"$$\\alpha \\impl \\beta \\ \\defp \\ \\neg\\alpha \\lor \\beta$$", |
36 |
|
"DEFP(IMPL(PREDVAR_3(), PREDVAR_4()), OR(NOT(PREDVAR_3()), PREDVAR_4()))" |
37 |
|
}, { |
38 |
|
"$$\\alpha \\equi \\beta \\ \\defp \\ (\\alpha \\impl \\beta) \\land (\\beta \\impl \\alpha)$$", |
39 |
|
"DEFP(EQUI(PREDVAR_3(), PREDVAR_4()), AND(IMPL(PREDVAR_3(), PREDVAR_4()), IMPL(PREDVAR_4(), PREDVAR_3())))" |
40 |
|
}, { |
41 |
|
"$\\alpha \\impl (\\forall x_1~(\\beta(x_1)))$", |
42 |
|
"IMPL(PREDVAR_3(), ALL(x_1(), PREDVAR_4(x_1())))" |
43 |
|
} |
44 |
|
}; |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
11
|
public LatexMathParserTest(String arg0) {... |
47 |
11
|
super(arg0); |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
11
|
protected void setUp() throws Exception {... |
51 |
11
|
super.setUp(); |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
11
|
protected void tearDown() throws Exception {... |
55 |
11
|
super.tearDown(); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
51
|
protected String[][] getTest() {... |
59 |
51
|
return test; |
60 |
|
} |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
62 |
11
|
protected MathParser createParser(final TextInput input) throws Exception {... |
63 |
11
|
final List operators = LoadXmlOperatorListUtility.getOperatorList( |
64 |
|
new DummyInternalKernelServices(), |
65 |
|
new File(getIndir(), |
66 |
|
"parser/latexMathOperators.xml")); |
67 |
11
|
final LatexMathParser result = new LatexMathParser(); |
68 |
11
|
result.setParameters(input, operators); |
69 |
11
|
return result; |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
72 |
1
|
public void testReadMaximalTerm00() throws Exception {... |
73 |
1
|
internalTest(0); |
74 |
|
} |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
76 |
1
|
public void testReadMaximalTerm01() throws Exception {... |
77 |
1
|
internalTest(1); |
78 |
|
} |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
80 |
1
|
public void testReadMaximalTerm02() throws Exception {... |
81 |
1
|
internalTest(2); |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
84 |
1
|
public void testReadMaximalTerm03() throws Exception {... |
85 |
1
|
internalTest(3); |
86 |
|
} |
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
88 |
1
|
public void testReadMaximalTerm04() throws Exception {... |
89 |
1
|
internalTest(4); |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
92 |
1
|
public void testReadMaximalTerm05() throws Exception {... |
93 |
1
|
internalTest(5); |
94 |
|
} |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
96 |
1
|
public void testReadMaximalTerm06() throws Exception {... |
97 |
1
|
internalTest(6); |
98 |
|
} |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
100 |
1
|
public void testReadMaximalTerm07() throws Exception {... |
101 |
1
|
internalTest(7); |
102 |
|
} |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
104 |
1
|
public void testReadMaximalTerm08() throws Exception {... |
105 |
1
|
internalTest(8); |
106 |
|
} |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
108 |
1
|
public void testReadMaximalTerm09() throws Exception {... |
109 |
1
|
internalTest(9); |
110 |
|
} |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
0
|
protected String[][] getExceptionTest() {... |
113 |
0
|
return null; |
114 |
|
} |
115 |
|
|
116 |
|
} |