| 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 (44) |
Complexity: 10 |
Complexity Density: 0.29 |
|
| 30 |
|
public class FormulaCheckerClassTermTest extends AbstractFormulaChecker { |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
private ModuleContext context; |
| 34 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 35 |
8
|
protected void setUp() throws Exception {... |
| 36 |
8
|
context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), |
| 37 |
|
"getElement()"); |
| 38 |
|
} |
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 40 |
8
|
protected void tearDown() throws Exception {... |
| 41 |
8
|
context = null; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
@throws |
| 50 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 51 |
1
|
public void testClassTermPositive01() throws Exception {... |
| 52 |
1
|
final Element ele = TestParser.createElement( |
| 53 |
|
"<CLASS><VAR id=\"x\" /><PREDVAR id=\"A\" /></CLASS>"); |
| 54 |
|
|
| 55 |
|
|
| 56 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 57 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
@throws |
| 66 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 67 |
1
|
public void testClassTermPositive02() throws Exception {... |
| 68 |
1
|
final Element ele = TestParser.createElement( |
| 69 |
|
"<CLASS>" + |
| 70 |
|
" <VAR id=\"x\" />" + |
| 71 |
|
" <PREDVAR id=\"phi\">" + |
| 72 |
|
" <VAR id=\"y\" />" + |
| 73 |
|
" <VAR id=\"x\" />" + |
| 74 |
|
" </PREDVAR>" + |
| 75 |
|
"</CLASS>"); |
| 76 |
|
|
| 77 |
|
|
| 78 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 79 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 |
|
@throws |
| 88 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 89 |
1
|
public void testClassTermPositive03() throws Exception {... |
| 90 |
1
|
final Element ele = TestParser.createElement( |
| 91 |
|
"<CLASS>" + |
| 92 |
|
" <VAR id=\"x\" />" + |
| 93 |
|
" <FORALL>" + |
| 94 |
|
" <VAR id=\"y\" />" + |
| 95 |
|
" <PREDVAR id=\"phi\">" + |
| 96 |
|
" <VAR id=\"y\" />" + |
| 97 |
|
" <VAR id=\"x\" />" + |
| 98 |
|
" </PREDVAR>" + |
| 99 |
|
" </FORALL>" + |
| 100 |
|
"</CLASS>"); |
| 101 |
|
|
| 102 |
|
|
| 103 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 104 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
@throws |
| 113 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 114 |
1
|
public void testClassTermNegative01() throws Exception {... |
| 115 |
1
|
final Element ele = TestParser.createElement( |
| 116 |
|
"<CLASS>" + |
| 117 |
|
" <VAR id=\"x\" />" + |
| 118 |
|
" <PREDVAR id=\"phi\">" + |
| 119 |
|
" <VAR id=\"y\" />" + |
| 120 |
|
" <VAR id=\"x\" />" + |
| 121 |
|
" </PREDVAR>" + |
| 122 |
|
" <PREDVAR id=\"phi\">" + |
| 123 |
|
" <VAR id=\"y\" />" + |
| 124 |
|
" <VAR id=\"x\" />" + |
| 125 |
|
" </PREDVAR>" + |
| 126 |
|
"</CLASS>"); |
| 127 |
|
|
| 128 |
|
|
| 129 |
1
|
LogicalCheckExceptionList list = |
| 130 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 131 |
1
|
assertEquals(1, list.size()); |
| 132 |
1
|
assertEquals(30760, list.get(0).getErrorCode()); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
@throws |
| 141 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 142 |
1
|
public void testClassTermNegative02() throws Exception {... |
| 143 |
1
|
final Element ele = TestParser.createElement( |
| 144 |
|
"<CLASS>" + |
| 145 |
|
" <VAR id=\"x\" />" + |
| 146 |
|
"</CLASS>"); |
| 147 |
|
|
| 148 |
1
|
LogicalCheckExceptionList list = |
| 149 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 150 |
1
|
assertEquals(1, list.size()); |
| 151 |
1
|
assertEquals(30760, list.get(0).getErrorCode()); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
| 157 |
|
|
| 158 |
|
|
| 159 |
|
@throws |
| 160 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 161 |
1
|
public void testClassTermNegative03() throws Exception {... |
| 162 |
1
|
final Element ele = TestParser.createElement( |
| 163 |
|
"<CLASS>" + |
| 164 |
|
" <PREDVAR id=\"phi\">" + |
| 165 |
|
" <VAR id=\"y\" />" + |
| 166 |
|
" <VAR id=\"x\" />" + |
| 167 |
|
" </PREDVAR>" + |
| 168 |
|
" <PREDVAR id=\"phi\">" + |
| 169 |
|
" <VAR id=\"y\" />" + |
| 170 |
|
" <VAR id=\"x\" />" + |
| 171 |
|
" </PREDVAR>" + |
| 172 |
|
"</CLASS>"); |
| 173 |
|
|
| 174 |
1
|
LogicalCheckExceptionList list = |
| 175 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 176 |
1
|
assertEquals(1, list.size()); |
| 177 |
1
|
assertEquals(30540, list.get(0).getErrorCode()); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|
| 183 |
|
|
| 184 |
|
|
| 185 |
|
@throws |
| 186 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 187 |
1
|
public void testClassTermNegative04() throws Exception {... |
| 188 |
1
|
final Element ele = TestParser.createElement( |
| 189 |
|
"<CLASS>" + |
| 190 |
|
" <VAR id=\"x\" />" + |
| 191 |
|
" <FORALL>" + |
| 192 |
|
" <VAR id=\"x\" />" + |
| 193 |
|
" <PREDVAR id=\"phi\">" + |
| 194 |
|
" <VAR id=\"y\" />" + |
| 195 |
|
" <VAR id=\"x\" />" + |
| 196 |
|
" </PREDVAR>" + |
| 197 |
|
" </FORALL>" + |
| 198 |
|
"</CLASS>"); |
| 199 |
|
|
| 200 |
1
|
LogicalCheckExceptionList list = |
| 201 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 202 |
1
|
assertEquals(1, list.size()); |
| 203 |
1
|
assertEquals(30550, list.get(0).getErrorCode()); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
@throws |
| 213 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 214 |
1
|
public void testClassTermNegative05() throws Exception {... |
| 215 |
1
|
final Element ele = TestParser.createElement( |
| 216 |
|
"<CLASS>" + |
| 217 |
|
" <VAR id=\"x\" />" + |
| 218 |
|
" <FORALL>" + |
| 219 |
|
" <VAR id=\"y\" />" + |
| 220 |
|
" <PREDVAR id=\"phi\">" + |
| 221 |
|
" <VAR id=\"y\" />" + |
| 222 |
|
" <VAR id=\"x\" />" + |
| 223 |
|
" </PREDVAR>" + |
| 224 |
|
" </FORALL>" + |
| 225 |
|
"</CLASS>"); |
| 226 |
|
|
| 227 |
1
|
LogicalCheckExceptionList list = |
| 228 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 229 |
1
|
assertTrue(!list.hasErrors()); |
| 230 |
1
|
assertEquals(0, list.size()); |
| 231 |
1
|
list = |
| 232 |
|
FormulaChecker.checkTerm(ele, context, getCheckerWithoutClass()); |
| 233 |
1
|
assertEquals(1, list.size()); |
| 234 |
1
|
assertEquals(30680, list.get(0).getErrorCode()); |
| 235 |
|
} |
| 236 |
|
|
| 237 |
|
|
| 238 |
|
} |