Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
18   106   6   3
0   41   0.33   6
6     1  
1    
 
  FormulaCheckerSubjectVariableTest       Line # 29 18 6 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    *
26    * @version $Revision: 1.1 $
27    * @author Michael Meyling
28    */
 
29    public class FormulaCheckerSubjectVariableTest extends AbstractFormulaChecker {
30   
31    private ModuleContext context;
32   
 
33  4 toggle protected void setUp() throws Exception {
34  4 context = new ModuleContext(new DefaultModuleAddress("http://memory.org/sample.xml"), "getElement()");
35    }
36   
 
37  4 toggle protected void tearDown() throws Exception {
38  4 context = null;
39    }
40   
41    /**
42    * Function: checkTerm(Element)
43    * Type: positive
44    * Data: x
45    *
46    * @throws Exception Test failed.
47    */
 
48  1 toggle public void testSubjectVariablePositive() throws Exception {
49  1 final Element ele = TestParser.createElement("<VAR id=\"x\"/>");
50    // System.out.println(ele.toString());
51  1 assertFalse(FormulaChecker.checkTerm(ele, context).hasErrors());
52  1 assertFalse(FormulaChecker.checkTerm(ele, context, getChecker()).hasErrors());
53  1 assertFalse(FormulaChecker.checkTerm(ele, context, getCheckerWithoutClass()).hasErrors());
54    }
55   
56    /**
57    * Function: checkTerm(Element)
58    * Type: negative, code 30710
59    * Data: no variable name
60    *
61    * @throws Exception Test failed.
62    */
 
63  1 toggle public void testSubjectVariableNegative1() throws Exception {
64  1 final Element ele = TestParser.createElement("<VAR />");
65    // System.out.println(ele.toString());
66  1 LogicalCheckExceptionList list =
67    FormulaChecker.checkTerm(ele, context);
68  1 assertEquals(1, list.size());
69  1 assertEquals(30710, list.get(0).getErrorCode());
70    }
71   
72    /**
73    * Function: checkTerm(Element)
74    * Type: negative, code 30710
75    * Data: x 12
76    *
77    * @throws Exception Test failed.
78    */
 
79  1 toggle public void testSubjectVariableNegative2() throws Exception {
80  1 final Element ele = TestParser.createElement("<VAR id=\"x\" ref=\"12\" />");
81    // System.out.println(ele.toString());
82  1 LogicalCheckExceptionList list =
83    FormulaChecker.checkTerm(ele, context);
84  1 assertEquals(1, list.size());
85  1 assertEquals(30710, list.get(0).getErrorCode());
86    }
87   
88   
89    /**
90    * Function: checkTerm(Element)
91    * Type: negative, code 30730
92    * Data: ?
93    *
94    * @throws Exception Test failed.
95    */
 
96  1 toggle public void testSubjectVariableNegative3() throws Exception {
97  1 final Element ele = TestParser.createElement("<VAR> <A/> </VAR>");
98    // System.out.println(ele.toString());
99  1 LogicalCheckExceptionList list =
100    FormulaChecker.checkTerm(ele, context);
101  1 assertEquals(1, list.size());
102  1 assertEquals(30730, list.get(0).getErrorCode());
103    }
104   
105   
106    }