| 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 (70) |
Complexity: 16 |
Complexity Density: 0.3 |
|
| 30 |
|
public class FormulaCheckerTermTest extends AbstractFormulaChecker { |
| 31 |
|
|
| 32 |
|
private ModuleContext context; |
| 33 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 34 |
14
|
protected void setUp() throws Exception {... |
| 35 |
14
|
context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()"); |
| 36 |
|
} |
| 37 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 38 |
14
|
protected void tearDown() throws Exception {... |
| 39 |
14
|
context = null; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@throws |
| 48 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 49 |
1
|
public void testTermPositive01() throws Exception {... |
| 50 |
1
|
final Element ele = TestParser.createElement( |
| 51 |
|
"<CLASS>" + |
| 52 |
|
" <VAR id=\"x\" />" + |
| 53 |
|
" <AND>" + |
| 54 |
|
" <PREDCON id=\"in\">" + |
| 55 |
|
" <VAR id=\"x\" />" + |
| 56 |
|
" <VAR id=\"a\" />" + |
| 57 |
|
" </PREDCON>" + |
| 58 |
|
" <PREDCON id=\"in\">" + |
| 59 |
|
" <VAR id=\"x\" />" + |
| 60 |
|
" <VAR id=\"b\" />" + |
| 61 |
|
" </PREDCON>" + |
| 62 |
|
" </AND>" + |
| 63 |
|
"</CLASS>"); |
| 64 |
|
|
| 65 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 66 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
@throws |
| 75 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 76 |
1
|
public void testTermPositive02() throws Exception {... |
| 77 |
1
|
final Element ele = TestParser.createElement( |
| 78 |
|
"<FUNVAR id=\"f\">" + |
| 79 |
|
" <VAR id=\"x\" />" + |
| 80 |
|
" <VAR id=\"y\" />" + |
| 81 |
|
" <VAR id=\"x\" />" + |
| 82 |
|
"</FUNVAR>"); |
| 83 |
|
|
| 84 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 85 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
@throws |
| 94 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 95 |
1
|
public void testTermPositive03() throws Exception {... |
| 96 |
1
|
final Element ele = TestParser.createElement( |
| 97 |
|
"<FUNCON id=\"power\">" + |
| 98 |
|
" <FUNCON id=\"union\">" + |
| 99 |
|
" <VAR id=\"x\" />" + |
| 100 |
|
" <VAR id=\"y\" />" + |
| 101 |
|
" </FUNCON>" + |
| 102 |
|
"</FUNCON>"); |
| 103 |
|
|
| 104 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 105 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
@throws |
| 114 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 115 |
1
|
public void testTermPositive04() throws Exception {... |
| 116 |
1
|
final Element ele = TestParser.createElement( |
| 117 |
|
"<VAR id=\"x\" />"); |
| 118 |
|
|
| 119 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors()); |
| 120 |
1
|
assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors()); |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
@throws |
| 129 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 130 |
1
|
public void testTermNegative01() throws Exception {... |
| 131 |
1
|
final Element ele = TestParser.createElement( |
| 132 |
|
"<AND><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></AND>"); |
| 133 |
|
|
| 134 |
1
|
LogicalCheckExceptionList list = |
| 135 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 136 |
1
|
assertEquals(1, list.size()); |
| 137 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
@throws |
| 146 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 147 |
1
|
public void testTermNegative02() throws Exception {... |
| 148 |
1
|
final Element ele = TestParser.createElement( |
| 149 |
|
"<UNKNOWN><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></UNKNOWN>"); |
| 150 |
|
|
| 151 |
1
|
LogicalCheckExceptionList list = |
| 152 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 153 |
1
|
assertEquals(1, list.size()); |
| 154 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
| 161 |
|
|
| 162 |
|
@throws |
| 163 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 164 |
1
|
public void testTermNegative03() throws Exception {... |
| 165 |
1
|
final Element ele = TestParser.createElement( |
| 166 |
|
"<OR><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></OR>"); |
| 167 |
|
|
| 168 |
1
|
LogicalCheckExceptionList list = |
| 169 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 170 |
1
|
assertEquals(1, list.size()); |
| 171 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
|
| 175 |
|
|
| 176 |
|
|
| 177 |
|
|
| 178 |
|
|
| 179 |
|
@throws |
| 180 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 181 |
1
|
public void testTermNegative04() throws Exception {... |
| 182 |
1
|
final Element ele = TestParser.createElement( |
| 183 |
|
"<IMPL><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></IMPL>"); |
| 184 |
|
|
| 185 |
1
|
LogicalCheckExceptionList list = |
| 186 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 187 |
1
|
assertEquals(1, list.size()); |
| 188 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 189 |
|
} |
| 190 |
|
|
| 191 |
|
|
| 192 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
@throws |
| 197 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 198 |
1
|
public void testTermNegative05() throws Exception {... |
| 199 |
1
|
final Element ele = TestParser.createElement( |
| 200 |
|
"<EQUI><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></EQUI>"); |
| 201 |
|
|
| 202 |
1
|
LogicalCheckExceptionList list = |
| 203 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 204 |
1
|
assertEquals(1, list.size()); |
| 205 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
@throws |
| 214 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 215 |
1
|
public void testTermNegative06() throws Exception {... |
| 216 |
1
|
final Element ele = TestParser.createElement( |
| 217 |
|
"<NOT><PREDVAR id=\"A\"/></NOT>"); |
| 218 |
|
|
| 219 |
1
|
LogicalCheckExceptionList list = |
| 220 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 221 |
1
|
assertEquals(1, list.size()); |
| 222 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 223 |
|
} |
| 224 |
|
|
| 225 |
|
|
| 226 |
|
|
| 227 |
|
|
| 228 |
|
|
| 229 |
|
|
| 230 |
|
@throws |
| 231 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 232 |
1
|
public void testTermNegative07() throws Exception {... |
| 233 |
1
|
final Element ele = TestParser.createElement( |
| 234 |
|
"<PREDVAR id=\"A\"/>"); |
| 235 |
|
|
| 236 |
1
|
LogicalCheckExceptionList list = |
| 237 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 238 |
1
|
assertEquals(1, list.size()); |
| 239 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
| 247 |
|
@throws |
| 248 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 249 |
1
|
public void testTermNegative08() throws Exception {... |
| 250 |
1
|
final Element ele = TestParser.createElement( |
| 251 |
|
"<FORALL><VAR id=\"x\" /><PREDVAR id=\"A\"/></FORALL>"); |
| 252 |
|
|
| 253 |
1
|
LogicalCheckExceptionList list = |
| 254 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 255 |
1
|
assertEquals(1, list.size()); |
| 256 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 257 |
|
} |
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
@throws |
| 265 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 266 |
1
|
public void testTermNegative09() throws Exception {... |
| 267 |
1
|
final Element ele = TestParser.createElement( |
| 268 |
|
"<EXISTS><VAR id=\"x\" /><PREDVAR id=\"A\"/></EXISTS>"); |
| 269 |
|
|
| 270 |
1
|
LogicalCheckExceptionList list = |
| 271 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 272 |
1
|
assertEquals(1, list.size()); |
| 273 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 274 |
|
} |
| 275 |
|
|
| 276 |
|
|
| 277 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
|
| 281 |
|
@throws |
| 282 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 283 |
1
|
public void testTermNegative10() throws Exception {... |
| 284 |
1
|
final Element ele = TestParser.createElement( |
| 285 |
|
"<EXISTSU><VAR id=\"x\" /><PREDVAR id=\"A\"/></EXISTSU>"); |
| 286 |
|
|
| 287 |
1
|
LogicalCheckExceptionList list = |
| 288 |
|
FormulaChecker.checkTerm(ele, context, getChecker()); |
| 289 |
1
|
assertEquals(1, list.size()); |
| 290 |
1
|
assertEquals(30620, list.get(0).getErrorCode()); |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
} |