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 (35) |
Complexity: 8 |
Complexity Density: 0.3 |
|
31 |
|
public class FormulaCheckerFormulaTest 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 |
6
|
protected void setUp() throws Exception {... |
38 |
6
|
context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()"); |
39 |
6
|
checker = new FormulaCheckerImpl(); |
40 |
|
} |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
42 |
6
|
protected void tearDown() throws Exception {... |
43 |
6
|
context = null; |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@throws |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
53 |
1
|
public void testFormulaPositive01() throws Exception {... |
54 |
1
|
final Element ele = BasicParser.createElement( |
55 |
|
"<PREDVAR id=\"A\"/>"); |
56 |
|
|
57 |
1
|
assertFalse(checker.checkFormula(ele, context).hasErrors()); |
58 |
1
|
assertFalse(checker.checkFormula(ele, context, getChecker()).hasErrors()); |
59 |
1
|
assertFalse(checker.checkFormula(ele, context, getCheckerWithoutClass()) |
60 |
|
.hasErrors()); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@throws |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
70 |
1
|
public void testFormulaPositive02() throws Exception {... |
71 |
1
|
final Element ele = BasicParser.createElement( |
72 |
|
"<NOT><PREDVAR id=\"A\"/></NOT>"); |
73 |
|
|
74 |
1
|
assertFalse(checker.checkFormula(ele, context).hasErrors()); |
75 |
1
|
assertFalse(checker.checkFormula(ele, context, getChecker()).hasErrors()); |
76 |
1
|
assertFalse(checker.checkFormula(ele, context, getCheckerWithoutClass()) |
77 |
|
.hasErrors()); |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@throws |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
87 |
1
|
public void testFormulaPositive03() throws Exception {... |
88 |
1
|
final Element ele = BasicParser.createElement( |
89 |
|
"<PREDCON id=\"true\"/>"); |
90 |
|
|
91 |
1
|
assertFalse(checker.checkFormula(ele, context).hasErrors()); |
92 |
1
|
assertFalse(checker.checkFormula(ele, context, getChecker()).hasErrors()); |
93 |
1
|
assertFalse(checker.checkFormula(ele, context, getCheckerWithoutClass()) |
94 |
|
.hasErrors()); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
@throws |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
104 |
1
|
public void testFormulaNegative01() throws Exception {... |
105 |
1
|
final Element ele = BasicParser.createElement("<VAR id=\"x\" />"); |
106 |
|
|
107 |
1
|
LogicalCheckExceptionList list = |
108 |
|
checker.checkFormula(ele, context, getChecker()); |
109 |
1
|
assertEquals(1, list.size()); |
110 |
1
|
assertEquals(30530, list.get(0).getErrorCode()); |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
@throws |
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
120 |
1
|
public void testFormulaNegative02() throws Exception {... |
121 |
1
|
final Element ele = BasicParser.createElement("<FUNVAR id=\"f\"><VAR id=\"x\" /></FUNVAR>"); |
122 |
|
|
123 |
1
|
LogicalCheckExceptionList list = |
124 |
|
checker.checkFormula(ele, context, getChecker()); |
125 |
1
|
assertEquals(1, list.size()); |
126 |
1
|
assertEquals(30530, list.get(0).getErrorCode()); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
@throws |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
136 |
1
|
public void testFormulaNegative03() throws Exception {... |
137 |
1
|
final Element ele = BasicParser.createElement("<FUNCON id=\"empty\"></FUNCON>"); |
138 |
|
|
139 |
1
|
LogicalCheckExceptionList list = |
140 |
|
checker.checkFormula(ele, context, getChecker()); |
141 |
1
|
assertEquals(1, list.size()); |
142 |
1
|
assertEquals(30530, list.get(0).getErrorCode()); |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
} |