Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
224   555   40   8.62
26   360   0.18   26
26     1.54  
1    
 
  ModuleConstantsExistenceCheckerTest       Line # 50 224 40 79.3% 0.79347825
 
  (13)
 
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.control;
16   
17    import org.qedeq.kernel.bo.logic.common.ExistenceChecker;
18    import org.qedeq.kernel.bo.logic.common.FunctionConstant;
19    import org.qedeq.kernel.bo.logic.common.FunctionKey;
20    import org.qedeq.kernel.bo.logic.common.PredicateConstant;
21    import org.qedeq.kernel.bo.logic.common.PredicateKey;
22    import org.qedeq.kernel.bo.module.KernelQedeqBo;
23    import org.qedeq.kernel.bo.module.ModuleConstantsExistenceChecker;
24    import org.qedeq.kernel.bo.service.control.DefaultKernelQedeqBo;
25    import org.qedeq.kernel.bo.service.logic.ModuleConstantsExistenceCheckerImpl;
26    import org.qedeq.kernel.bo.test.QedeqBoTestCase;
27    import org.qedeq.kernel.se.base.module.Axiom;
28    import org.qedeq.kernel.se.base.module.ChangedRuleList;
29    import org.qedeq.kernel.se.base.module.FunctionDefinition;
30    import org.qedeq.kernel.se.base.module.InitialFunctionDefinition;
31    import org.qedeq.kernel.se.base.module.InitialPredicateDefinition;
32    import org.qedeq.kernel.se.base.module.LatexList;
33    import org.qedeq.kernel.se.base.module.LinkList;
34    import org.qedeq.kernel.se.base.module.PredicateDefinition;
35    import org.qedeq.kernel.se.base.module.ProofList;
36    import org.qedeq.kernel.se.base.module.Proposition;
37    import org.qedeq.kernel.se.base.module.Rule;
38    import org.qedeq.kernel.se.common.DefaultModuleAddress;
39    import org.qedeq.kernel.se.common.ModuleAddress;
40    import org.qedeq.kernel.se.common.RuleKey;
41    import org.qedeq.kernel.se.common.SourceFileExceptionList;
42    import org.qedeq.kernel.se.dto.module.LatexListVo;
43   
44   
45    /**
46    * For testing of checking existence of module constants.
47    *
48    * @author Michael Meyling
49    */
 
50    public class ModuleConstantsExistenceCheckerTest extends QedeqBoTestCase {
51   
52    final Rule classDefinitionRule = new Rule() {
 
53  0 toggle public Axiom getAxiom() {
54  0 return null;
55    }
 
56  0 toggle public PredicateDefinition getPredicateDefinition() {
57  0 return null;
58    }
 
59  0 toggle public InitialPredicateDefinition getInitialPredicateDefinition() {
60  0 return null;
61    }
 
62  0 toggle public InitialFunctionDefinition getInitialFunctionDefinition() {
63  0 return null;
64    }
 
65  0 toggle public FunctionDefinition getFunctionDefinition() {
66  0 return null;
67    }
 
68  0 toggle public Proposition getProposition() {
69  0 return null;
70    }
 
71  0 toggle public Rule getRule() {
72  0 return this;
73    }
 
74  0 toggle public String getName() {
75  0 return "CLASS_DEFINITION_BY_FORMULA";
76    }
77   
 
78  0 toggle public String getVersion() {
79  0 return "1.00.00";
80    }
81   
 
82  0 toggle public LatexList getDescription() {
83  0 return new LatexListVo();
84    }
85   
 
86  0 toggle public ChangedRuleList getChangedRuleList() {
87  0 return null;
88    }
89   
 
90  0 toggle public LinkList getLinkList() {
91  0 return null;
92    }
93   
 
94  0 toggle public ProofList getProofList() {
95  0 return null;
96    }
97    };
98   
99    /**
100    * Load following dependencies:
101    * <pre>
102    * 011 -> 012(a)
103    * 011 -> 012(b)
104    * </pre>
105    * In <code>012</code> the identity operator is defined.
106    *
107    * @throws Exception
108    */
 
109  1 toggle public void testModuleConstantsExistenceChecker_01() throws Exception {
110  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC011.xml"));
111  1 if (!getServices().checkWellFormedness(address)) {
112  0 getServices().getQedeqBo(address).getErrors().printStackTrace(System.out);
113  0 throw getServices().getQedeqBo(address).getErrors();
114    }
115  1 final DefaultKernelQedeqBo qedeq = (DefaultKernelQedeqBo) getServices().getQedeqBo(address);
116  1 SourceFileExceptionList errors = qedeq.getErrors();
117  1 SourceFileExceptionList warnings = qedeq.getWarnings();
118  1 assertNotNull(warnings);
119  1 assertEquals(0, warnings.size());
120  1 assertNotNull(errors);
121  1 assertEquals(0, errors.size());
122    }
123   
124    /**
125    * Load following dependencies:
126    * <pre>
127    * 021 -> 022
128    * 021 -> 023
129    * </pre>
130    * In <code>022</code> and <code>023</code> the identity operator is defined.
131    *
132    * @throws Exception
133    */
 
134  1 toggle public void testModuleConstantsExistenceChecker_02() throws Exception {
135  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC021.xml"));
136  1 if (!getServices().checkWellFormedness(address)) {
137  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
138  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
139  1 assertNotNull(warnings);
140  1 assertEquals(0, warnings.size());
141  1 assertEquals(1, errors.size());
142  1 assertEquals(123476, errors.get(0).getErrorCode());
143  1 assertEquals(38, errors.get(0).getSourceArea().getStartPosition().getRow());
144  1 assertEquals(15, errors.get(0).getSourceArea().getStartPosition().getColumn());
145    } else {
146  0 fail("failure for double definition of identity operator expected");
147    }
148    }
149   
150    /**
151    * Load following dependencies:
152    * <pre>
153    * 031 -> 032
154    * 031 -> 033 -> 034
155    * </pre>
156    * In <code>032</code> and <code>034</code> the identity operator is defined.
157    *
158    * @throws Exception
159    */
 
160  1 toggle public void testModuleConstantsExistenceChecker_03() throws Exception {
161  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC031.xml"));
162  1 if (!getServices().checkWellFormedness(address)) {
163  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
164  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
165  1 assertNotNull(warnings);
166  1 assertEquals(0, warnings.size());
167  1 assertEquals(1, errors.size());
168  1 assertEquals(123476, errors.get(0).getErrorCode());
169  1 assertEquals(38, errors.get(0).getSourceArea().getStartPosition().getRow());
170  1 assertEquals(15, errors.get(0).getSourceArea().getStartPosition().getColumn());
171    } else {
172  0 fail("failure for double definition of identity operator expected");
173    }
174    }
175   
176    /**
177    * Load following dependencies:
178    * <pre>
179    * 041 -> 043 -> 044 -> 042
180    * 041 -> 042
181    * </pre>
182    * In <code>042</code> the identity operator is defined.
183    *
184    * @throws Exception
185    */
 
186  1 toggle public void testModuleConstantsExistenceChecker_04() throws Exception {
187  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC041.xml"));
188  1 SourceFileExceptionList errors;
189  1 if (!getServices().checkWellFormedness(address)) {
190  0 errors = getServices().getQedeqBo(address).getErrors();
191  0 throw errors;
192    }
193  1 errors = getServices().getQedeqBo(address).getErrors();
194  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
195  1 assertNotNull(warnings);
196  1 assertEquals(0, warnings.size());
197  1 assertNotNull(errors);
198  1 assertEquals(0, errors.size());
199    }
200   
201    /**
202    * Load following dependencies:
203    * <pre>
204    * 051 -> 052
205    * </pre>
206    * In <code>052</code> the identity operator is defined.
207    *
208    * @throws Exception
209    */
 
210  1 toggle public void testModuleConstantsExistenceChecker_05() throws Exception {
211  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC051.xml"));
212  1 if (!getServices().checkWellFormedness(address)) {
213  0 getServices().getQedeqBo(address).getErrors().printStackTrace(System.out);
214  0 throw getServices().getQedeqBo(address).getErrors();
215    }
216  1 final DefaultKernelQedeqBo qedeq = (DefaultKernelQedeqBo) getServices().getQedeqBo(address);
217  1 SourceFileExceptionList errors = qedeq.getErrors();
218  1 SourceFileExceptionList warnings = qedeq.getWarnings();
219  1 assertNotNull(warnings);
220  1 assertEquals(0, warnings.size());
221  1 assertNotNull(errors);
222  1 assertEquals(0, errors.size());
223   
224  1 ModuleConstantsExistenceChecker checker = qedeq.getExistenceChecker();
225   
226  1 assertEquals("MCEC052.equal", checker.getIdentityOperator());
227  1 assertFalse(qedeq.equals(checker.getQedeq(new PredicateKey(ExistenceChecker.NAME_EQUAL, "" + 2))));
228  1 assertNull(checker.getQedeq(new PredicateKey(ExistenceChecker.NAME_EQUAL, "" + 2)));
229  1 assertNull(checker.getQedeq(new PredicateKey("unknown." + ExistenceChecker.NAME_EQUAL, "" + 2)));
230  1 assertEquals(getServices().getQedeqBo(new DefaultModuleAddress(getFile("existence/MCEC052.xml"))),
231    checker.getQedeq(new PredicateKey("MCEC052." + ExistenceChecker.NAME_EQUAL, "" + 2)));
232    {
233  1 final PredicateKey predicate = new PredicateKey("MCEC052." + ExistenceChecker.NAME_EQUAL, "" + 2);
234  1 assertTrue(checker.predicateExists(predicate));
235  1 final PredicateConstant def = checker.get(predicate);
236    // assertEquals("#1 \\ = \\ #2", def.getLatexPattern());
237    // assertEquals("" + 2, def.getArgumentNumber());
238  1 assertNull(def);
239  1 assertTrue(checker.isInitialPredicate(predicate));
240    }
241   
242    {
243  1 assertTrue(checker.predicateExists("MCEC052." + ExistenceChecker.NAME_EQUAL, 2));
244  1 final PredicateConstant def = checker.getPredicate("MCEC052." + ExistenceChecker.NAME_EQUAL, 2);
245    // assertEquals("#1 \\ = \\ #2", def.getLatexPattern());
246    // assertEquals("" + 2, def.getArgumentNumber());
247  1 assertNull(def);
248    }
249   
250    {
251  1 final PredicateKey predicate = new PredicateKey("MCEC052x." + ExistenceChecker.NAME_EQUAL, "" + 2);
252  1 assertFalse(checker.predicateExists(predicate));
253  1 final PredicateConstant def = checker.get(predicate);
254  1 assertNull(def);
255  1 assertTrue(!checker.isInitialPredicate(predicate));
256    }
257   
258    {
259  1 assertFalse(checker.predicateExists("MCEC052x." + ExistenceChecker.NAME_EQUAL, 2));
260  1 final PredicateConstant def = checker.getPredicate("MCEC052x." + ExistenceChecker.NAME_EQUAL, 2);
261  1 assertNull(def);
262    }
263   
264  1 assertEquals("MCEC052.equal", checker.getIdentityOperator());
265  1 assertFalse(qedeq.equals(checker.getQedeq(new FunctionKey("union", "" + 2))));
266  1 assertNull(checker.getQedeq(new FunctionKey("union", "" + 2)));
267  1 assertNull(checker.getQedeq(new FunctionKey("unknown." + "union", "" + 2)));
268  1 assertEquals(getServices().getQedeqBo(new DefaultModuleAddress(getFile("existence/MCEC052.xml"))),
269    checker.getQedeq(new FunctionKey("MCEC052." + "union", "" + 2)));
270    {
271  1 final FunctionKey function = new FunctionKey("MCEC052x." + "union", "" + 2);
272  1 assertFalse(checker.functionExists(function));
273  1 assertNull(checker.get(function));
274    }
275    {
276  1 final FunctionKey function = new FunctionKey("MCEC05." + "union", "" + 2);
277  1 assertFalse(checker.functionExists(function));
278  1 assertNull(checker.get(function));
279    }
280    {
281  1 final FunctionKey function = new FunctionKey("MCEC052." + "uniont", "" + 2);
282  1 assertFalse(checker.functionExists(function));
283  1 assertNull(checker.get(function));
284    }
285    {
286  1 final FunctionKey function = new FunctionKey("MCEC052." + "union", "" + 2);
287  1 assertTrue(checker.functionExists(function));
288  1 final FunctionConstant def2 = checker.get(function);
289    // assertEquals("(#1 \\cup #2)", def2.getLatexPattern());
290    // assertEquals("" + 2, def2.getArgumentNumber());
291  1 assertEquals("PREDCON ( \"equal\", FUNCON ( \"union\", VAR ( \"x\"), VAR ( \"y\")), "
292    + "CLASS ( VAR ( \"z\"), OR ( PREDCON ( \"in\", VAR ( \"z\"), VAR ( \"x\")),"
293    + " PREDCON ( \"in\", VAR ( \"z\"), VAR ( \"y\")))))",
294    def2.getCompleteFormula().toString());
295  1 assertEquals("union", def2.getName());
296  1 assertEquals("2", def2.getArguments());
297  1 assertTrue(!checker.isInitialFunction(function));
298    }
299    {
300  1 assertTrue(checker.functionExists("MCEC052." + "union", 2));
301  1 final FunctionConstant def3 = checker.getFunction("MCEC052." + "union", 2);
302    // assertEquals("(#1 \\cup #2)", def3.getLatexPattern());
303    // assertEquals("" + 2, def3.getArgumentNumber());
304  1 assertEquals("CLASS ( VAR ( \"z\"), OR ( PREDCON ( \"in\", VAR ( \"z\"), VAR ( \"x\")),"
305    + " PREDCON ( \"in\", VAR ( \"z\"), VAR ( \"y\"))))", def3.getDefiningTerm().toString());
306  1 assertEquals("union", def3.getName());
307  1 assertEquals("2", def3.getArguments());
308    }
309    {
310  1 assertFalse(checker.functionExists("MCEC052x." + "union", 2));
311    }
312   
313    }
314   
315    /**
316    * Load following dependencies:
317    * <pre>
318    * 061 -> 062(a)
319    * 061 -> 062(b)
320    * </pre>
321    * In <code>062</code> the identity operator and the class operator is defined.
322    *
323    * @throws Exception
324    */
 
325  1 toggle public void testModuleConstantsExistenceChecker_06() throws Exception {
326  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC061.xml"));
327  1 if (!getServices().checkWellFormedness(address)) {
328  0 getServices().getQedeqBo(address).getErrors().printStackTrace(System.out);
329  0 throw getServices().getQedeqBo(address).getErrors();
330    }
331  1 final DefaultKernelQedeqBo qedeq = (DefaultKernelQedeqBo) getServices().getQedeqBo(address);
332  1 SourceFileExceptionList errors = qedeq.getErrors();
333  1 SourceFileExceptionList warnings = qedeq.getWarnings();
334  1 assertNotNull(warnings);
335  1 assertEquals(0, warnings.size());
336  1 assertNotNull(errors);
337  1 assertEquals(0, errors.size());
338   
339  1 ModuleConstantsExistenceChecker checker = qedeq.getExistenceChecker();
340   
341  1 assertEquals("MCEC062a.equal", checker.getIdentityOperator());
342  1 assertFalse(qedeq.equals(checker.getQedeq(new PredicateKey(ExistenceChecker.NAME_EQUAL, "" + 2))));
343  1 assertNull(checker.getQedeq(new PredicateKey(ExistenceChecker.NAME_EQUAL, "" + 2)));
344  1 assertNull(checker.getQedeq(new PredicateKey("unknown." + ExistenceChecker.NAME_EQUAL, "" + 2)));
345  1 final PredicateKey key = new PredicateKey("MCEC062a." + ExistenceChecker.NAME_EQUAL, "" + 2);
346  1 assertEquals(getServices().getQedeqBo(new DefaultModuleAddress(getFile("existence/MCEC062.xml"))),
347    checker.getQedeq(key));
348  1 final PredicateConstant def = checker.get(key);
349    // assertEquals("#1 \\ = \\ #2", def.getLatexPattern());
350    // assertEquals("" + 2, def.getArgumentNumber());
351  1 assertNull(def);
352  1 assertTrue(checker.isInitialPredicate(key));
353   
354  1 assertEquals("MCEC062a.equal", checker.getIdentityOperator());
355  1 assertFalse(qedeq.equals(checker.getQedeq(new FunctionKey("union", "" + 2))));
356  1 assertNull(checker.getQedeq(new FunctionKey("union", "" + 2)));
357  1 assertNull(checker.getQedeq(new FunctionKey("unknown." + "union", "" + 2)));
358  1 final FunctionKey key2 = new FunctionKey("MCEC062a." + "union", "" + 2);
359  1 assertEquals(getServices().getQedeqBo(new DefaultModuleAddress(getFile("existence/MCEC062.xml"))),
360    checker.getQedeq(key2));
361  1 final FunctionConstant def2 = checker.get(key2);
362    // assertEquals("(#1 \\cup #2)", def2.getLatexPattern());
363    // assertEquals("" + 2, def2.getArgumentNumber());
364  1 assertEquals("CLASS ( VAR ( \"z\"), OR ( PREDCON ( \"in\", VAR ( \"z\"), VAR ( \"x\")),"
365    + " PREDCON ( \"in\", VAR ( \"z\"), VAR ( \"y\"))))", def2.getDefiningTerm().toString());
366  1 assertEquals("union", def2.getName());
367  1 assertEquals("2", def2.getArguments());
368  1 assertTrue(!checker.isInitialFunction(key2));
369   
370    }
371   
372    /**
373    * Load following dependencies:
374    * <pre>
375    * 071 -> 072
376    * 071 -> 073
377    * </pre>
378    * In <code>072</code> and <code>073</code> the identity operator and the class operator is defined.
379    *
380    * @throws Exception
381    */
 
382  1 toggle public void testModuleConstantsExistenceChecker_07() throws Exception {
383  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC071.xml"));
384  1 if (!getServices().checkWellFormedness(address)) {
385  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
386  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
387  1 assertNotNull(warnings);
388  1 assertEquals(0, warnings.size());
389  1 assertEquals(1, errors.size());
390  1 assertEquals(37390, errors.get(0).getErrorCode());
391  1 assertEquals(38, errors.get(0).getSourceArea().getStartPosition().getRow());
392  1 assertEquals(15, errors.get(0).getSourceArea().getStartPosition().getColumn());
393    } else {
394  0 fail("failure for double definition of class operator expected");
395    }
396    }
397   
398    /**
399    * Load following dependencies:
400    * <pre>
401    * 081 -> 082 -> 083
402    * </pre>
403    * In <code>081</code> and <code>083</code> the the class operator is defined.
404    *
405    * @throws Exception
406    */
 
407  1 toggle public void testModuleConstantsExistenceChecker_08() throws Exception {
408  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC081.xml"));
409  1 if (!getServices().checkWellFormedness(address)) {
410  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
411  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
412  1 assertNotNull(warnings);
413  1 assertEquals(0, warnings.size());
414    // System.out.println(errors);
415  1 assertEquals(1, errors.size());
416  1 assertEquals(37260, errors.get(0).getErrorCode());
417  1 assertEquals(118, errors.get(0).getSourceArea().getStartPosition().getRow());
418  1 assertEquals(52, errors.get(0).getSourceArea().getStartPosition().getColumn());
419    } else {
420  0 fail("failure for double definition of class operator expected");
421    }
422    }
423   
424    /**
425    * Load following dependencies:
426    * <pre>
427    * 091 -> 092 -> 093
428    * </pre>
429    * In <code>091</code> and <code>093</code> the the identity predicate is defined.
430    *
431    * @throws Exception
432    */
 
433  1 toggle public void testModuleConstantsExistenceChecker_09() throws Exception {
434  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC091.xml"));
435  1 if (!getServices().checkWellFormedness(address)) {
436  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
437  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
438  1 assertNotNull(warnings);
439  1 assertEquals(0, warnings.size());
440    // System.out.println(errors);
441  1 assertEquals(1, errors.size());
442  1 assertEquals(123476, errors.get(0).getErrorCode());
443  1 assertEquals(125, errors.get(0).getSourceArea().getStartPosition().getRow());
444  1 assertEquals(11, errors.get(0).getSourceArea().getStartPosition().getColumn());
445    } else {
446  0 fail("failure for double definition of class operator expected");
447    }
448    }
449   
450    /**
451    * Load following dependencies:
452    * <pre>
453    * 101
454    * </pre>
455    * In <code>101</code> the identity operator is not defined before defining a function constant.
456    *
457    * @throws Exception
458    */
 
459  1 toggle public void testModuleConstantsExistenceChecker_10() throws Exception {
460  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC101.xml"));
461  1 if (!getServices().checkWellFormedness(address)) {
462  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
463  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
464  1 assertNotNull(warnings);
465  1 assertEquals(0, warnings.size());
466    // System.out.println(errors);
467  1 assertEquals(1, errors.size());
468  1 assertEquals(40530, errors.get(0).getErrorCode());
469  1 assertEquals(151, errors.get(0).getSourceArea().getStartPosition().getRow());
470  1 assertEquals(15, errors.get(0).getSourceArea().getStartPosition().getColumn());
471    } else {
472  0 fail("usage of identitiy opererator before definition of identity operator");
473    }
474    }
475   
476    /**
477    * Load following dependencies:
478    * <pre>
479    * 111
480    * </pre>
481    * In <code>111</code> the class operator is defined twice.
482    *
483    * @throws Exception
484    */
 
485  1 toggle public void testModuleConstantsExistenceChecker_11() throws Exception {
486  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC111.xml"));
487  1 if (!getServices().checkWellFormedness(address)) {
488  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
489  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
490  1 assertNotNull(warnings);
491  1 assertEquals(0, warnings.size());
492    // System.out.println(errors);
493  1 assertEquals(1, errors.size());
494  1 assertEquals(37260, errors.get(0).getErrorCode());
495  1 assertEquals(146, errors.get(0).getSourceArea().getStartPosition().getRow());
496  1 assertEquals(52, errors.get(0).getSourceArea().getStartPosition().getColumn());
497    } else {
498  0 fail("failure for double definition of class operator expected");
499    }
500    }
501   
502    /**
503    * Load following dependencies:
504    * <pre>
505    * 121 -> 122
506    * 121 -> 123
507    * </pre>
508    * In <code>122</code> and in <code>123> the class operator is defined.
509    *
510    * @throws Exception
511    */
 
512  1 toggle public void testModuleConstantsExistenceChecker_12() throws Exception {
513  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC121.xml"));
514  1 if (!getServices().checkWellFormedness(address)) {
515  1 SourceFileExceptionList errors = getServices().getQedeqBo(address).getErrors();
516  1 SourceFileExceptionList warnings = getServices().getQedeqBo(address).getWarnings();
517  1 assertNotNull(warnings);
518  1 assertEquals(0, warnings.size());
519    // System.out.println(errors);
520  1 assertEquals(1, errors.size());
521  1 assertEquals(37390, errors.get(0).getErrorCode());
522  1 assertEquals(38, errors.get(0).getSourceArea().getStartPosition().getRow());
523  1 assertEquals(15, errors.get(0).getSourceArea().getStartPosition().getColumn());
524    } else {
525  0 fail("failure for double definition of class operator expected");
526    }
527    }
528   
529    /**
530    * Load following dependencies:
531    * <pre>
532    * 131
533    * </pre>
534    * In <code>131</code> is ok but has a class definition. Now we add an additional one.
535    *
536    * @throws Exception
537    */
 
538  1 toggle public void testModuleConstantsExistenceChecker_13() throws Exception {
539  1 final ModuleAddress address = new DefaultModuleAddress(getFile("existence/MCEC131.xml"));
540  1 if (!getServices().checkWellFormedness(address)) {
541  0 fail("no failure expected");
542    }
543  1 final KernelQedeqBo qedeq = (KernelQedeqBo) getServices().getQedeqBo(address);
544  1 final ModuleConstantsExistenceCheckerImpl checker = (ModuleConstantsExistenceCheckerImpl)
545    qedeq.getExistenceChecker();
546  1 try {
547  1 checker.add(new RuleKey("CLASS_DEFINITION_BY_FORMULA", "1.00.00"), classDefinitionRule);
548  0 fail("exception expected");
549    } catch (IllegalArgumentException e) {
550    // expected
551    }
552  1 checker.add(new RuleKey("CLASS_DEFINITION_BY_FORMULA", "0.00.00"), classDefinitionRule);
553    }
554   
555    }