1 ///  @file    TestRequiredElements.cs
2 ///  @brief   Test hasRequiredElements unit tests
3 ///  @author  Frank Bergmann (Csharp conversion)
4 ///  @author  Akiya Jouraku (Csharp conversion)
5 ///  @author  Sarah Keating
6 ///
7 ///
8 ///  ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
9 ///
10 ///  DO NOT EDIT THIS FILE.
11 ///
12 ///  This file was generated automatically by converting the file located at
13 ///  src/sbml/test/TestRequiredElements.cpp
14 ///  using the conversion program dev/utilities/translateTests/translateTests.pl.
15 ///  Any changes made here will be lost the next time the file is regenerated.
16 ///
17 ///  -----------------------------------------------------------------------------
18 ///  This file is part of libSBML.  Please visit http://sbml.org for more
19 ///  information about SBML, and the latest version of libSBML.
20 ///
21 ///  Copyright 2005-2010 California Institute of Technology.
22 ///  Copyright 2002-2005 California Institute of Technology and
23 ///                      Japan Science and Technology Corporation.
24 ///
25 ///  This library is free software; you can redistribute it and/or modify it
26 ///  under the terms of the GNU Lesser General Public License as published by
27 ///  the Free Software Foundation.  A copy of the license agreement is provided
28 ///  in the file named "LICENSE.txt" included with this software distribution
29 ///  and also available online as http://sbml.org/software/libsbml/license.html
30 ///  -----------------------------------------------------------------------------
31 
32 
33 namespace LibSBMLCSTest.sbml {
34 
35   using libsbmlcs;
36 
37   using System;
38 
39   using System.IO;
40 
41   public class TestRequiredElements {
42     public class AssertionError : System.Exception
43     {
AssertionError()44       public AssertionError() : base()
45       {
46 
47       }
48     }
49 
50 
assertTrue(bool condition)51     static void assertTrue(bool condition)
52     {
53       if (condition == true)
54       {
55         return;
56       }
57       throw new AssertionError();
58     }
59 
assertEquals(object a, object b)60     static void assertEquals(object a, object b)
61     {
62       if ( (a == null) && (b == null) )
63       {
64         return;
65       }
66       else if ( (a == null) || (b == null) )
67       {
68         throw new AssertionError();
69       }
70       else if (a.Equals(b))
71       {
72         return;
73       }
74 
75       throw new AssertionError();
76     }
77 
assertNotEquals(object a, object b)78     static void assertNotEquals(object a, object b)
79     {
80       if ( (a == null) && (b == null) )
81       {
82         throw new AssertionError();
83       }
84       else if ( (a == null) || (b == null) )
85       {
86         return;
87       }
88       else if (a.Equals(b))
89       {
90         throw new AssertionError();
91       }
92     }
93 
assertEquals(bool a, bool b)94     static void assertEquals(bool a, bool b)
95     {
96       if ( a == b )
97       {
98         return;
99       }
100       throw new AssertionError();
101     }
102 
assertNotEquals(bool a, bool b)103     static void assertNotEquals(bool a, bool b)
104     {
105       if ( a != b )
106       {
107         return;
108       }
109       throw new AssertionError();
110     }
111 
assertEquals(int a, int b)112     static void assertEquals(int a, int b)
113     {
114       if ( a == b )
115       {
116         return;
117       }
118       throw new AssertionError();
119     }
120 
assertNotEquals(int a, int b)121     static void assertNotEquals(int a, int b)
122     {
123       if ( a != b )
124       {
125         return;
126       }
127       throw new AssertionError();
128     }
129 
130 
test_AlgebraicRule()131     public void test_AlgebraicRule()
132     {
133       AlgebraicRule ar = new AlgebraicRule(2,4);
134       assertEquals( false, (ar.hasRequiredElements()) );
135       ar.setMath(libsbml.parseFormula("ar"));
136       assertEquals( true, ar.hasRequiredElements() );
137       ar = null;
138     }
139 
test_AssignmentRule()140     public void test_AssignmentRule()
141     {
142       AssignmentRule r = new AssignmentRule(2,4);
143       assertEquals( false, (r.hasRequiredElements()) );
144       r.setMath(libsbml.parseFormula("ar"));
145       assertEquals( true, r.hasRequiredElements() );
146       r = null;
147     }
148 
test_Compartment()149     public void test_Compartment()
150     {
151       Compartment c = new Compartment(2,4);
152       assertEquals( true, c.hasRequiredElements() );
153       c = null;
154     }
155 
test_CompartmentType()156     public void test_CompartmentType()
157     {
158       CompartmentType ct = new CompartmentType(2,4);
159       assertEquals( true, ct.hasRequiredElements() );
160       ct = null;
161     }
162 
test_Constraint()163     public void test_Constraint()
164     {
165       Constraint c = new Constraint(2,4);
166       assertEquals( false, (c.hasRequiredElements()) );
167       c.setMath(libsbml.parseFormula("a+b"));
168       assertEquals( true, c.hasRequiredElements() );
169       c = null;
170     }
171 
test_Delay()172     public void test_Delay()
173     {
174       Delay d = new Delay(2,4);
175       assertEquals( false, (d.hasRequiredElements()) );
176       d.setMath(libsbml.parseFormula("a+b"));
177       assertEquals( true, d.hasRequiredElements() );
178       d = null;
179     }
180 
test_Event()181     public void test_Event()
182     {
183       Event e = new Event(2,4);
184       assertEquals( false, (e.hasRequiredElements()) );
185       Trigger t = new Trigger(2,4);
186       t.setMath(libsbml.parseFormula("true"));
187       e.setTrigger(t);
188       assertEquals( false, (e.hasRequiredElements()) );
189       e.createEventAssignment();
190       assertEquals( true, e.hasRequiredElements() );
191       e = null;
192     }
193 
test_EventAssignment()194     public void test_EventAssignment()
195     {
196       EventAssignment ea = new EventAssignment(2,4);
197       assertEquals( false, (ea.hasRequiredElements()) );
198       ea.setMath(libsbml.parseFormula("fd"));
199       assertEquals( true, ea.hasRequiredElements() );
200       ea = null;
201     }
202 
test_FunctionDefinition()203     public void test_FunctionDefinition()
204     {
205       FunctionDefinition fd = new FunctionDefinition(2,4);
206       assertEquals( false, (fd.hasRequiredElements()) );
207       fd.setMath(libsbml.parseFormula("fd"));
208       assertEquals( true, fd.hasRequiredElements() );
209       fd = null;
210     }
211 
test_InitialAssignment()212     public void test_InitialAssignment()
213     {
214       InitialAssignment ia = new InitialAssignment(2,4);
215       assertEquals( false, (ia.hasRequiredElements()) );
216       ia.setMath(libsbml.parseFormula("ia"));
217       assertEquals( true, ia.hasRequiredElements() );
218       ia = null;
219     }
220 
test_KineticLaw()221     public void test_KineticLaw()
222     {
223       KineticLaw kl = new KineticLaw(2,4);
224       assertEquals( false, (kl.hasRequiredElements()) );
225       kl.setMath(libsbml.parseFormula("kl"));
226       assertEquals( true, kl.hasRequiredElements() );
227       kl = null;
228     }
229 
test_Model()230     public void test_Model()
231     {
232       Model m = new Model(2,4);
233       assertEquals( true, m.hasRequiredElements() );
234       m = null;
235     }
236 
test_Model_L1V1()237     public void test_Model_L1V1()
238     {
239       Model m = new Model(1,1);
240       assertEquals( false, (m.hasRequiredElements()) );
241       m.createCompartment();
242       assertEquals( false, (m.hasRequiredElements()) );
243       m.createSpecies();
244       assertEquals( false, (m.hasRequiredElements()) );
245       m.createReaction();
246       assertEquals( true, m.hasRequiredElements() );
247       m = null;
248     }
249 
test_Model_L1V2()250     public void test_Model_L1V2()
251     {
252       Model m = new Model(1,2);
253       assertEquals( false, (m.hasRequiredElements()) );
254       m.createCompartment();
255       assertEquals( true, m.hasRequiredElements() );
256       m = null;
257     }
258 
test_ModifierSpeciesReference()259     public void test_ModifierSpeciesReference()
260     {
261       ModifierSpeciesReference msr = new ModifierSpeciesReference(2,4);
262       assertEquals( true, msr.hasRequiredElements() );
263       msr = null;
264     }
265 
test_Parameter()266     public void test_Parameter()
267     {
268       Parameter p = new Parameter(2,4);
269       assertEquals( true, p.hasRequiredElements() );
270       p = null;
271     }
272 
test_RateRule()273     public void test_RateRule()
274     {
275       RateRule r = new RateRule(2,4);
276       assertEquals( false, (r.hasRequiredElements()) );
277       r.setMath(libsbml.parseFormula("ar"));
278       assertEquals( true, r.hasRequiredElements() );
279       r = null;
280     }
281 
test_Reaction()282     public void test_Reaction()
283     {
284       Reaction r = new Reaction(2,4);
285       assertEquals( true, r.hasRequiredElements() );
286       r = null;
287     }
288 
test_Species()289     public void test_Species()
290     {
291       Species s = new Species(2,4);
292       assertEquals( true, s.hasRequiredElements() );
293       s = null;
294     }
295 
test_SpeciesReference()296     public void test_SpeciesReference()
297     {
298       SpeciesReference sr = new SpeciesReference(2,4);
299       assertEquals( true, sr.hasRequiredElements() );
300       sr = null;
301     }
302 
test_SpeciesType()303     public void test_SpeciesType()
304     {
305       SpeciesType st = new SpeciesType(2,4);
306       assertEquals( true, st.hasRequiredElements() );
307       st = null;
308     }
309 
test_StoichiometryMath()310     public void test_StoichiometryMath()
311     {
312       StoichiometryMath sm = new StoichiometryMath(2,4);
313       assertEquals( false, (sm.hasRequiredElements()) );
314       sm.setMath(libsbml.parseFormula("ar"));
315       assertEquals( true, sm.hasRequiredElements() );
316       sm = null;
317     }
318 
test_Trigger()319     public void test_Trigger()
320     {
321       Trigger t = new Trigger(2,4);
322       assertEquals( false, (t.hasRequiredElements()) );
323       t.setMath(libsbml.parseFormula("ar"));
324       assertEquals( true, t.hasRequiredElements() );
325       t = null;
326     }
327 
test_Unit()328     public void test_Unit()
329     {
330       Unit u = new Unit(2,4);
331       assertEquals( true, u.hasRequiredElements() );
332       u = null;
333     }
334 
test_UnitDefinition()335     public void test_UnitDefinition()
336     {
337       UnitDefinition ud = new UnitDefinition(2,4);
338       assertEquals( false, (ud.hasRequiredElements()) );
339       ud.createUnit();
340       assertEquals( true, ud.hasRequiredElements() );
341       ud = null;
342     }
343 
test_UnitDefinition_L1()344     public void test_UnitDefinition_L1()
345     {
346       UnitDefinition ud = new UnitDefinition(1,2);
347       assertEquals( true, ud.hasRequiredElements() );
348       ud = null;
349     }
350 
351   }
352 }
353 
354