Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
14   92   5   2.8
0   37   0.36   5
5     1  
1    
 
  FormulaCheckerNegationTest       Line # 30 14 5 100% 1.0
 
No Tests
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, 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.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    * For testing the {@link org.qedeq.kernel.bo.logic.FormulaChecker}.
25    * Testing formulas made of negation.
26    *
27    * @version $Revision: 1.1 $
28    * @author Michael Meyling
29    */
 
30    public class FormulaCheckerNegationTest extends AbstractFormulaChecker {
31   
32    private ModuleContext context;
33   
 
34  3 toggle protected void setUp() throws Exception {
35  3 context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()");
36    }
37   
 
38  3 toggle protected void tearDown() throws Exception {
39  3 context = null;
40    }
41   
42    /**
43    * Function: checkFormula(Element)
44    * Type: positive
45    * Data: -A
46    *
47    * @throws Exception Test failed.
48    */
 
49  1 toggle public void testNegationPositive01() throws Exception {
50  1 final Element ele = TestParser.createElement(
51    "<NOT><PREDVAR id=\"A\"/></NOT>");
52    // System.out.println(ele.toString());
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    * Function: checkFormula(Element)
61    * Type: negative, code 30710
62    * Data: -
63    *
64    * @throws Exception Test failed.
65    */
 
66  1 toggle public void testNegationNegative01() throws Exception {
67  1 final Element ele = TestParser.createElement("<NOT />");
68    // System.out.println(ele.toString());
69  1 LogicalCheckExceptionList list =
70    FormulaChecker.checkFormula(ele, context, getChecker());
71  1 assertEquals(1, list.size());
72  1 assertEquals(30710, list.get(0).getErrorCode());
73    }
74   
75    /**
76    * Function: checkFormula(Element)
77    * Type: negative, code 30710
78    * Data: -(A, B)
79    *
80    * @throws Exception Test failed.
81    */
 
82  1 toggle public void testNegationNegative02() throws Exception {
83  1 final Element ele = TestParser.createElement(
84    "<NOT><PREDVAR id=\"A\"/><PREDVAR id=\"B\"/></NOT>");
85    // System.out.println(ele.toString());
86  1 LogicalCheckExceptionList list =
87    FormulaChecker.checkFormula(ele, context, getChecker());
88  1 assertEquals(1, list.size());
89  1 assertEquals(30710, list.get(0).getErrorCode());
90    }
91   
92    }