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