Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
11   155   3   3.67
0   112   0.27   3
3     1  
1    
 
  FormulaUtilityReplaceOperatorVariableTest       Line # 30 11 3 64.3% 0.64285713
 
  (1)
 
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.common;
17   
18    import org.qedeq.base.test.QedeqTestCase;
19    import org.qedeq.kernel.bo.module.ModuleLabels;
20    import org.qedeq.kernel.bo.service.control.Element2LatexImpl;
21    import org.qedeq.kernel.bo.service.control.Element2Utf8Impl;
22    import org.qedeq.kernel.se.base.list.Element;
23    import org.qedeq.kernel.xml.parser.BasicParser;
24   
25    /**
26    * For testing the {@link org.qedeq.kernel.bo.logic.common.FormulaUtility}.
27    *
28    * @author Michael Meyling
29    */
 
30    public class FormulaUtilityReplaceOperatorVariableTest extends QedeqTestCase {
31   
32   
33    private Element predVar1;
34   
35    private Element funVar1;
36   
37   
 
38  1 toggle protected void setUp() throws Exception {
39   
40  1 predVar1 = BasicParser.createElement(
41    "<PREDVAR id=\"equal\">" +
42    "<VAR id=\"x\" />" +
43    "<VAR id=\"y\" />" +
44    "</PREDVAR>");
45  1 funVar1 = BasicParser.createElement(
46    "<FUNVAR id=\"union\">" +
47    "<VAR id=\"u\" />" +
48    "<VAR id=\"v\" />" +
49    "</FUNVAR>");
50  1 super.setUp();
51    }
52   
53    /**
54    * Function: replaceOperatorVariable.
55    *
56    * @throws Exception Test failed.
57    */
 
58  1 toggle public void test_Positive01() throws Exception {
59  1 final Element ele1 = BasicParser.createElement(
60    "<AND>" +
61    "<FORALL>" +
62    "<VAR id=\"x\" />" +
63    "<PREDVAR id=\"equal\">" +
64    "<VAR id=\"x\" />" +
65    "<VAR id=\"x\" />" +
66    "</PREDVAR>" +
67    "</FORALL>" +
68    "<FORALL>" +
69    "<VAR id=\"y\" />" +
70    "<FORALL>" +
71    "<VAR id=\"z\" />" +
72    "<PREDVAR id=\"equal\">" +
73    "<VAR id=\"y\" />" +
74    "<CLASS>" +
75    "<VAR id=\"x\" />" +
76    "<PREDVAR id=\"\\phi\">" +
77    "<VAR id=\"x\" />" +
78    "</PREDVAR>" +
79    "</CLASS>" +
80    "</PREDVAR>" +
81    "</FORALL>" +
82    "</FORALL>" +
83    "</AND>");
84    // System.out.println(ele.toString());
85   
86  1 final Element ele2 = BasicParser.createElement(
87    "<AND>" +
88    "<PREDCON id=\"\\leq\">" +
89    "<VAR id=\"x\" />" +
90    "<VAR id=\"y\" />" +
91    "</PREDCON>" +
92    "<PREDCON id=\"\\leq\">" +
93    "<VAR id=\"y\" />" +
94    "<VAR id=\"x\" />" +
95    "</PREDCON>" +
96    "</AND>");
97    // System.out.println(ele.toString());
98   
99  1 final Element ele3 = BasicParser.createElement(
100    "<AND>" +
101    "<FORALL>" +
102    "<VAR id=\"x\" />" +
103    "<AND>" +
104    "<PREDCON id=\"\\leq\">" +
105    "<VAR id=\"x\" />" +
106    "<VAR id=\"x\" />" +
107    "</PREDCON>" +
108    "<PREDCON id=\"\\leq\">" +
109    "<VAR id=\"x\" />" +
110    "<VAR id=\"x\" />" +
111    "</PREDCON>" +
112    "</AND>" +
113    "</FORALL>" +
114    "<FORALL>" +
115    "<VAR id=\"y\" />" +
116    "<FORALL>" +
117    "<VAR id=\"z\" />" +
118    "<AND>" +
119    "<PREDCON id=\"\\leq\">" +
120    "<VAR id=\"y\" />" +
121    "<CLASS>" +
122    "<VAR id=\"x\" />" +
123    "<PREDVAR id=\"\\phi\">" +
124    "<VAR id=\"x\" />" +
125    "</PREDVAR>" +
126    "</CLASS>" +
127    "</PREDCON>" +
128    "<PREDCON id=\"\\leq\">" +
129    "<CLASS>" +
130    "<VAR id=\"x\" />" +
131    "<PREDVAR id=\"\\phi\">" +
132    "<VAR id=\"x\" />" +
133    "</PREDVAR>" +
134    "</CLASS>" +
135    "<VAR id=\"y\" />" +
136    "</PREDCON>" +
137    "</AND>" +
138    "</FORALL>" +
139    "</FORALL>" +
140    "</AND>");
141    // println(ele3);
142    // println(FormulaUtility.replaceOperatorVariable(ele1,
143    // predVar1, ele2));
144  1 assertTrue(ele3.equals(FormulaUtility.replaceOperatorVariable(ele1,
145    predVar1, ele2)));
146    }
147   
 
148  0 toggle public void println(final Element element) {
149  0 ModuleLabels labels = new ModuleLabels();
150  0 Element2LatexImpl converter = new Element2LatexImpl(labels);
151  0 Element2Utf8Impl textConverter = new Element2Utf8Impl(converter);
152  0 System.out.println(textConverter.getUtf8(element));
153    }
154   
155    }