Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
65   144   6   10.83
0   89   0.09   6
6     1  
1    
 
  Qedeq2LatexTest       Line # 28 65 6 97.2% 0.97183096
 
  (4)
 
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    package org.qedeq.kernel.bo.service.latex;
16   
17    import org.qedeq.kernel.bo.common.QedeqBo;
18    import org.qedeq.kernel.bo.test.QedeqBoTestCase;
19    import org.qedeq.kernel.se.common.DefaultModuleAddress;
20    import org.qedeq.kernel.se.common.ModuleAddress;
21    import org.qedeq.kernel.se.state.WellFormedState;
22   
23    /**
24    * For test of generating LaTeX output.
25    *
26    * @author Michael Meyling
27    */
 
28    public class Qedeq2LatexTest extends QedeqBoTestCase {
29   
 
30  0 toggle public Qedeq2LatexTest() {
31  0 super();
32    }
33   
 
34  4 toggle public Qedeq2LatexTest(final String name) {
35  4 super(name);
36    }
37   
38    /**
39    * Check that there are no LaTeX warnings in Q2L001.
40    *
41    * @throws Exception
42    */
 
43  1 toggle public void testQ2L001_v1() throws Exception {
44  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L001.xml"));
45  1 final QedeqBo bo = getServices().getQedeqBo(address);
46  1 getServices().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address,
47    null);
48  1 assertFalse(bo.getLoadingState().isFailure());
49  1 assertFalse(WellFormedState.STATE_UNCHECKED.equals(bo.getWellFormedState()));
50  1 assertTrue(bo.hasErrors());
51  1 assertNotNull(bo.getErrors());
52  1 assertEquals(1, bo.getErrors().size());
53  1 assertFalse(bo.hasWarnings());
54  1 assertNotNull(bo.getWarnings());
55  1 assertEquals(0, bo.getWarnings().size());
56    }
57   
58    /**
59    * Check that there are no LaTeX warnings in Q2L001.
60    * After checking the module with errors.
61    *
62    * @throws Exception
63    */
 
64  1 toggle public void testQ2L001_v2() throws Exception {
65  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L001.xml"));
66  1 getServices().checkWellFormedness(address);
67  1 final QedeqBo bo = getServices().getQedeqBo(address);
68  1 assertTrue(bo.getWellFormedState().isFailure());
69  1 assertFalse(bo.hasWarnings());
70  1 assertNotNull(bo.getWarnings());
71  1 assertEquals(0, bo.getWarnings().size());
72  1 assertEquals(1, bo.getErrors().size());
73  1 assertEquals(11231, bo.getErrors().get(0).getErrorCode());
74  1 getServices().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address,
75    null);
76  1 assertTrue(bo.getWellFormedState().isFailure());
77  1 assertFalse(bo.hasWarnings());
78  1 assertNotNull(bo.getWarnings());
79  1 assertEquals(0, bo.getWarnings().size());
80  1 assertEquals(1, bo.getErrors().size());
81  1 assertEquals(11231, bo.getErrors().get(0).getErrorCode());
82   
83    }
84   
85    /**
86    * Check that there is one LaTeX warning in Q2L001.
87    *
88    * @throws Exception
89    */
 
90  1 toggle public void testQ2L002() throws Exception {
91  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L002.xml"));
92  1 getServices().checkWellFormedness(address);
93  1 final QedeqBo bo = getServices().getQedeqBo(address);
94  1 assertFalse(bo.getWellFormedState().isFailure());
95  1 assertFalse(bo.hasWarnings());
96  1 assertNotNull(bo.getWarnings());
97  1 assertEquals(0, bo.getWarnings().size());
98  1 assertFalse(bo.hasErrors());
99  1 assertNotNull(bo.getErrors());
100  1 assertEquals(0, bo.getErrors().size());
101  1 getServices().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address,
102    null);
103  1 assertFalse(bo.getWellFormedState().isFailure());
104  1 assertFalse(bo.hasErrors());
105  1 assertNotNull(bo.getErrors());
106  1 assertEquals(0, bo.getErrors().size());
107    // System.out.println(bo.getWarnings());
108  1 assertEquals(1, bo.getWarnings().size());
109  1 assertEquals(80007, bo.getWarnings().get(0).getErrorCode());
110   
111    }
112   
113    /**
114    * Check that there is one LaTeX warning in Q2L003.
115    *
116    * @throws Exception
117    */
 
118  1 toggle public void testQ2L003() throws Exception {
119  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L003.xml"));
120  1 getServices().checkWellFormedness(address);
121  1 final QedeqBo bo = getServices().getQedeqBo(address);
122  1 assertFalse(bo.getWellFormedState().isFailure());
123  1 assertFalse(bo.hasWarnings());
124  1 assertNotNull(bo.getWarnings());
125  1 assertEquals(0, bo.getWarnings().size());
126  1 assertFalse(bo.hasErrors());
127  1 assertNotNull(bo.getErrors());
128  1 assertEquals(0, bo.getErrors().size());
129  1 getServices().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address,
130    null);
131  1 assertFalse(bo.getWellFormedState().isFailure());
132  1 assertFalse(bo.hasErrors());
133  1 assertNotNull(bo.getErrors());
134  1 assertEquals(0, bo.getErrors().size());
135    // System.out.println("\n" + bo.getWarnings());
136  1 assertEquals(3, bo.getWarnings().size());
137  1 assertEquals(80008, bo.getWarnings().get(0).getErrorCode());
138  1 assertEquals(610007, bo.getWarnings().get(1).getErrorCode());
139  1 assertEquals(610007, bo.getWarnings().get(2).getErrorCode());
140   
141    }
142   
143   
144    }