Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
51   132   8   6.38
0   77   0.16   8
8     1  
1    
 
  Qedeq2LatexTest       Line # 30 51 8 96.6% 0.9661017
 
  (4)
 
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    package org.qedeq.kernel.bo.service.latex;
16   
17    import org.qedeq.base.test.QedeqTestCase;
18    import org.qedeq.kernel.bo.QedeqBo;
19    import org.qedeq.kernel.bo.context.KernelContext;
20    import org.qedeq.kernel.bo.test.KernelFacade;
21    import org.qedeq.kernel.common.DefaultModuleAddress;
22    import org.qedeq.kernel.common.LogicalState;
23    import org.qedeq.kernel.common.ModuleAddress;
24   
25    /**
26    * For test of generating LaTeX output.
27    *
28    * @author Michael Meyling
29    */
 
30    public class Qedeq2LatexTest extends QedeqTestCase {
31   
 
32  4 toggle protected void setUp() throws Exception {
33  4 super.setUp();
34  4 KernelFacade.startup();
35    }
36   
 
37  4 toggle protected void tearDown() throws Exception {
38  4 KernelFacade.shutdown();
39  4 super.tearDown();
40    }
41   
 
42  0 toggle public Qedeq2LatexTest() {
43  0 super();
44    }
45   
 
46  4 toggle public Qedeq2LatexTest(final String name) {
47  4 super(name);
48    }
49   
50    /**
51    * Check that there are no LaTeX warnings in Q2L001.
52    *
53    * @throws Exception
54    */
 
55  1 toggle public void testQ2L001_v1() throws Exception {
56  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L001.xml"));
57  1 final QedeqBo bo = KernelContext.getInstance().getQedeqBo(address);
58  1 KernelContext.getInstance().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address, null);
59  1 assertFalse(bo.getLoadingState().isFailure());
60  1 assertEquals(LogicalState.STATE_UNCHECKED, bo.getLogicalState());
61  1 assertNull(bo.getErrors());
62  1 assertNull(bo.getWarnings());
63    }
64   
65    /**
66    * Check that there are no LaTeX warnings in Q2L001.
67    * After checking the module with errors.
68    *
69    * @throws Exception
70    */
 
71  1 toggle public void testQ2L001_v2() throws Exception {
72  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L001.xml"));
73  1 KernelContext.getInstance().checkModule(address);
74  1 final QedeqBo bo = KernelContext.getInstance().getQedeqBo(address);
75  1 assertTrue(bo.getLogicalState().isFailure());
76  1 assertNull(bo.getWarnings());
77  1 assertEquals(1, bo.getErrors().size());
78  1 assertEquals(11231, bo.getErrors().get(0).getErrorCode());
79  1 KernelContext.getInstance().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address, null);
80  1 assertTrue(bo.getLogicalState().isFailure());
81  1 assertNull(bo.getWarnings());
82  1 assertEquals(1, bo.getErrors().size());
83  1 assertEquals(11231, bo.getErrors().get(0).getErrorCode());
84   
85    }
86   
87    /**
88    * Check that there is one LaTeX warning in Q2L001.
89    *
90    * @throws Exception
91    */
 
92  1 toggle public void testQ2L002() throws Exception {
93  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L002.xml"));
94  1 KernelContext.getInstance().checkModule(address);
95  1 final QedeqBo bo = KernelContext.getInstance().getQedeqBo(address);
96  1 assertFalse(bo.getLogicalState().isFailure());
97  1 assertNull(bo.getWarnings());
98  1 assertNull(bo.getErrors());
99  1 KernelContext.getInstance().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address, null);
100  1 assertFalse(bo.getLogicalState().isFailure());
101  1 assertNull(bo.getErrors());
102  1 System.out.println(bo.getWarnings());
103  1 assertEquals(1, bo.getWarnings().size());
104  1 assertEquals(80007, bo.getWarnings().get(0).getErrorCode());
105   
106    }
107   
108    /**
109    * Check that there is one LaTeX warning in Q2L003.
110    *
111    * @throws Exception
112    */
 
113  1 toggle public void testQ2L003() throws Exception {
114  1 final ModuleAddress address = new DefaultModuleAddress(getFile("latex/Q2L003.xml"));
115  1 KernelContext.getInstance().checkModule(address);
116  1 final QedeqBo bo = KernelContext.getInstance().getQedeqBo(address);
117  1 assertFalse(bo.getLogicalState().isFailure());
118  1 assertNull(bo.getWarnings());
119  1 assertNull(bo.getErrors());
120  1 KernelContext.getInstance().executePlugin("org.qedeq.kernel.bo.service.latex.Qedeq2LatexPlugin", address, null);
121  1 assertFalse(bo.getLogicalState().isFailure());
122  1 assertNull(bo.getErrors());
123  1 System.out.println("\n" + bo.getWarnings());
124  1 assertEquals(3, bo.getWarnings().size());
125  1 assertEquals(80008, bo.getWarnings().get(0).getErrorCode());
126  1 assertEquals(80010, bo.getWarnings().get(1).getErrorCode());
127  1 assertEquals(80010, bo.getWarnings().get(2).getErrorCode());
128   
129    }
130   
131   
132    }