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