Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
15   96   5   3
0   41   0.33   5
5     1  
1    
 
  FormulaCheckerNegationTest       Line # 31 15 5 100% 1.0
 
No Tests
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
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    * For testing the {@link org.qedeq.kernel.bo.logic.FormulaChecker}.
27    * Testing formulas made of negation.
28    *
29    * @author Michael Meyling
30    */
 
31    public class FormulaCheckerNegationTest extends AbstractFormulaChecker {
32   
33    private ModuleContext context;
34   
35    private FormulaChecker checker;
36   
 
37  3 toggle protected void setUp() throws Exception {
38  3 context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()");
39  3 checker = new FormulaCheckerImpl();
40    }
41   
 
42  3 toggle protected void tearDown() throws Exception {
43  3 context = null;
44    }
45   
46    /**
47    * Function: checkFormula(Element)
48    * Type: positive
49    * Data: -A
50    *
51    * @throws Exception Test failed.
52    */
 
53  1 toggle public void testNegationPositive01() throws Exception {
54  1 final Element ele = BasicParser.createElement(
55    "<NOT><PREDVAR id=\"A\"/></NOT>");
56    // System.out.println(ele.toString());
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    * Function: checkFormula(Element)
65    * Type: negative, code 30710
66    * Data: -
67    *
68    * @throws Exception Test failed.
69    */
 
70  1 toggle public void testNegationNegative01() throws Exception {
71  1 final Element ele = BasicParser.createElement("<NOT />");
72    // System.out.println(ele.toString());
73  1 LogicalCheckExceptionList list =
74    checker.checkFormula(ele, context, getChecker());
75  1 assertEquals(1, list.size());
76  1 assertEquals(30710, list.get(0).getErrorCode());
77    }
78   
79    /**
80    * Function: checkFormula(Element)
81    * Type: negative, code 30710
82    * Data: -(A, B)
83    *
84    * @throws Exception Test failed.
85    */
 
86  1 toggle public void testNegationNegative02() throws Exception {
87  1 final Element ele = BasicParser.createElement(
88    "<NOT><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></NOT>");
89    // System.out.println(ele.toString());
90  1 LogicalCheckExceptionList list =
91    checker.checkFormula(ele, context, getChecker());
92  1 assertEquals(1, list.size());
93  1 assertEquals(30710, list.get(0).getErrorCode());
94    }
95   
96    }