1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
package org.qedeq.kernel.bo.service.heuristic; |
16 |
|
|
17 |
|
import java.io.File; |
18 |
|
import java.io.IOException; |
19 |
|
|
20 |
|
import org.qedeq.base.io.UrlUtility; |
21 |
|
import org.qedeq.kernel.bo.common.QedeqBo; |
22 |
|
import org.qedeq.kernel.bo.logic.model.Model; |
23 |
|
import org.qedeq.kernel.bo.logic.model.ThreeModel; |
24 |
|
import org.qedeq.kernel.bo.logic.model.UnaryModel; |
25 |
|
import org.qedeq.kernel.bo.module.KernelQedeqBo; |
26 |
|
import org.qedeq.kernel.bo.test.KernelFacade; |
27 |
|
import org.qedeq.kernel.bo.test.QedeqBoTestCase; |
28 |
|
import org.qedeq.kernel.se.common.ModuleAddress; |
29 |
|
import org.qedeq.kernel.se.common.SourceFileExceptionList; |
30 |
|
import org.qedeq.kernel.se.visitor.InterruptException; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@author |
36 |
|
|
|
|
| 80.5% |
Uncovered Elements: 8 (41) |
Complexity: 9 |
Complexity Density: 0.32 |
|
37 |
|
public class HeuristicCheckerPluginTest extends QedeqBoTestCase { |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
|
|
| 66.7% |
Uncovered Elements: 8 (24) |
Complexity: 5 |
Complexity Density: 0.31 |
|
42 |
4
|
public QedeqBo check(final Model model, final File dir, final String xml) throws IOException,... |
43 |
|
SourceFileExceptionList, InterruptException { |
44 |
4
|
final File xmlFile = new File(dir, xml); |
45 |
4
|
final ModuleAddress address = KernelFacade.getKernelContext().getModuleAddress( |
46 |
|
UrlUtility.toUrl(xmlFile)); |
47 |
4
|
final KernelQedeqBo prop = (KernelQedeqBo) KernelFacade.getKernelContext().loadModule( |
48 |
|
address); |
49 |
4
|
if (prop.hasErrors()) { |
50 |
0
|
throw prop.getErrors(); |
51 |
|
} |
52 |
4
|
KernelFacade.getKernelContext().loadRequiredModules(prop.getModuleAddress()); |
53 |
4
|
if (prop.hasErrors()) { |
54 |
0
|
throw prop.getErrors(); |
55 |
|
} |
56 |
4
|
KernelFacade.getKernelContext().checkWellFormedness(prop.getModuleAddress()); |
57 |
4
|
if (prop.hasErrors()) { |
58 |
0
|
throw prop.getErrors(); |
59 |
|
} |
60 |
4
|
getInternalServices().getConfig().setServiceKeyValue(new HeuristicCheckerPlugin(), "model", |
61 |
|
model.getClass().getName()); |
62 |
4
|
getServices().executePlugin( |
63 |
|
"org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPlugin", prop.getModuleAddress(), |
64 |
|
null); |
65 |
4
|
if (prop.hasErrors()) { |
66 |
0
|
throw prop.getErrors(); |
67 |
|
} |
68 |
4
|
return prop; |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
@throws |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
76 |
1
|
public void testQedeqLogicScript1() throws Exception {... |
77 |
1
|
final QedeqBo bo = check(new ThreeModel(), getDocDir(), "math/qedeq_logic_v1.xml"); |
78 |
1
|
assertEquals(0, bo.getErrors().size()); |
79 |
1
|
assertEquals(0, bo.getWarnings().size()); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@throws |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
87 |
1
|
public void testQedeqLogicScript2() throws Exception {... |
88 |
1
|
final QedeqBo bo = check(new UnaryModel(), getDocDir(), "math/qedeq_logic_v1.xml"); |
89 |
1
|
assertEquals(0, bo.getErrors().size()); |
90 |
1
|
assertEquals(0, bo.getWarnings().size()); |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
@throws |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
98 |
1
|
public void testQedeqSetTheoryScript1() throws Exception {... |
99 |
1
|
final QedeqBo bo = check(new ThreeModel(), getDocDir(), "math/qedeq_set_theory_v1.xml"); |
100 |
1
|
assertEquals(0, bo.getErrors().size()); |
101 |
1
|
assertEquals(46, bo.getWarnings().size()); |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
@throws |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
109 |
1
|
public void testQedeqSetTheoryScript2() throws Exception {... |
110 |
1
|
final QedeqBo bo = check(new UnaryModel(), getDocDir(), "math/qedeq_set_theory_v1.xml"); |
111 |
1
|
assertEquals(0, bo.getErrors().size()); |
112 |
1
|
assertEquals(2, bo.getWarnings().size()); |
113 |
|
} |
114 |
|
|
115 |
|
} |