1 /// @file TestRequiredAttributes.cs 2 /// @brief Test hasRequiredAttributes unit tests 3 /// @author Frank Bergmann (Csharp conversion) 4 /// @author Akiya Jouraku (Csharp conversion) 5 /// @author Ben Bornstein 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/TestRequiredAttributes.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 TestRequiredAttributes { 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( true, ar.hasRequiredAttributes() ); 135 ar = null; 136 } 137 test_AlgebraicRule_L1()138 public void test_AlgebraicRule_L1() 139 { 140 AlgebraicRule ar = new AlgebraicRule(1,2); 141 assertEquals( false, (ar.hasRequiredAttributes()) ); 142 ar.setFormula("ar"); 143 assertEquals( true, ar.hasRequiredAttributes() ); 144 ar = null; 145 } 146 test_AssignmentRule()147 public void test_AssignmentRule() 148 { 149 AssignmentRule r = new AssignmentRule(2,4); 150 assertEquals( false, (r.hasRequiredAttributes()) ); 151 r.setVariable("r"); 152 assertEquals( true, r.hasRequiredAttributes() ); 153 r = null; 154 } 155 test_AssignmentRule_L1()156 public void test_AssignmentRule_L1() 157 { 158 AssignmentRule r = new AssignmentRule(1,2); 159 assertEquals( false, (r.hasRequiredAttributes()) ); 160 r.setVariable("r"); 161 assertEquals( false, (r.hasRequiredAttributes()) ); 162 r.setFormula("r"); 163 assertEquals( true, r.hasRequiredAttributes() ); 164 r = null; 165 } 166 test_Compartment()167 public void test_Compartment() 168 { 169 Compartment c = new Compartment(2,4); 170 assertEquals( false, (c.hasRequiredAttributes()) ); 171 c.setId("c"); 172 assertEquals( true, c.hasRequiredAttributes() ); 173 c = null; 174 } 175 test_CompartmentType()176 public void test_CompartmentType() 177 { 178 CompartmentType ct = new CompartmentType(2,4); 179 assertEquals( false, (ct.hasRequiredAttributes()) ); 180 ct.setId("c"); 181 assertEquals( true, ct.hasRequiredAttributes() ); 182 ct = null; 183 } 184 test_Constraint()185 public void test_Constraint() 186 { 187 Constraint c = new Constraint(2,4); 188 assertEquals( true, c.hasRequiredAttributes() ); 189 c = null; 190 } 191 test_Delay()192 public void test_Delay() 193 { 194 Delay d = new Delay(2,4); 195 assertEquals( true, d.hasRequiredAttributes() ); 196 d = null; 197 } 198 test_Event()199 public void test_Event() 200 { 201 Event e = new Event(2,4); 202 assertEquals( true, e.hasRequiredAttributes() ); 203 e = null; 204 } 205 test_EventAssignment()206 public void test_EventAssignment() 207 { 208 EventAssignment ea = new EventAssignment(2,4); 209 assertEquals( false, (ea.hasRequiredAttributes()) ); 210 ea.setVariable("ea"); 211 assertEquals( true, ea.hasRequiredAttributes() ); 212 ea = null; 213 } 214 test_FunctionDefinition()215 public void test_FunctionDefinition() 216 { 217 FunctionDefinition fd = new FunctionDefinition(2,4); 218 assertEquals( false, (fd.hasRequiredAttributes()) ); 219 fd.setId("fd"); 220 assertEquals( true, fd.hasRequiredAttributes() ); 221 fd = null; 222 } 223 test_InitialAssignment()224 public void test_InitialAssignment() 225 { 226 InitialAssignment ia = new InitialAssignment(2,4); 227 assertEquals( false, (ia.hasRequiredAttributes()) ); 228 ia.setSymbol("ia"); 229 assertEquals( true, ia.hasRequiredAttributes() ); 230 ia = null; 231 } 232 test_KineticLaw()233 public void test_KineticLaw() 234 { 235 KineticLaw kl = new KineticLaw(2,4); 236 assertEquals( true, kl.hasRequiredAttributes() ); 237 kl = null; 238 } 239 test_KineticLaw_L1()240 public void test_KineticLaw_L1() 241 { 242 KineticLaw kl = new KineticLaw(1,2); 243 assertEquals( false, (kl.hasRequiredAttributes()) ); 244 kl.setFormula("kl"); 245 assertEquals( true, kl.hasRequiredAttributes() ); 246 kl = null; 247 } 248 test_Model()249 public void test_Model() 250 { 251 Model m = new Model(2,4); 252 assertEquals( true, m.hasRequiredAttributes() ); 253 m = null; 254 } 255 test_ModifierSpeciesReference()256 public void test_ModifierSpeciesReference() 257 { 258 ModifierSpeciesReference msr = new ModifierSpeciesReference(2,4); 259 assertEquals( false, (msr.hasRequiredAttributes()) ); 260 msr.setSpecies("msr"); 261 assertEquals( true, msr.hasRequiredAttributes() ); 262 msr = null; 263 } 264 test_Parameter()265 public void test_Parameter() 266 { 267 Parameter p = new Parameter(2,4); 268 assertEquals( false, (p.hasRequiredAttributes()) ); 269 p.setId("p"); 270 assertEquals( true, p.hasRequiredAttributes() ); 271 p = null; 272 } 273 test_Parameter_L1V1()274 public void test_Parameter_L1V1() 275 { 276 Parameter p = new Parameter(1,1); 277 assertEquals( false, (p.hasRequiredAttributes()) ); 278 p.setId("p"); 279 assertEquals( false, (p.hasRequiredAttributes()) ); 280 p.setValue(12); 281 assertEquals( true, p.hasRequiredAttributes() ); 282 p = null; 283 } 284 test_RateRule()285 public void test_RateRule() 286 { 287 RateRule r = new RateRule(2,4); 288 assertEquals( false, (r.hasRequiredAttributes()) ); 289 r.setVariable("r"); 290 assertEquals( true, r.hasRequiredAttributes() ); 291 r = null; 292 } 293 test_RateRule_L1()294 public void test_RateRule_L1() 295 { 296 RateRule r = new RateRule(1,2); 297 assertEquals( false, (r.hasRequiredAttributes()) ); 298 r.setVariable("r"); 299 assertEquals( false, (r.hasRequiredAttributes()) ); 300 r.setFormula("r"); 301 assertEquals( true, r.hasRequiredAttributes() ); 302 r = null; 303 } 304 test_Reaction()305 public void test_Reaction() 306 { 307 Reaction r = new Reaction(2,4); 308 assertEquals( false, (r.hasRequiredAttributes()) ); 309 r.setId("r"); 310 assertEquals( true, r.hasRequiredAttributes() ); 311 r = null; 312 } 313 test_Species()314 public void test_Species() 315 { 316 Species s = new Species(2,4); 317 assertEquals( false, (s.hasRequiredAttributes()) ); 318 s.setId("s"); 319 assertEquals( false, (s.hasRequiredAttributes()) ); 320 s.setCompartment("c"); 321 assertEquals( true, s.hasRequiredAttributes() ); 322 s = null; 323 } 324 test_SpeciesReference()325 public void test_SpeciesReference() 326 { 327 SpeciesReference sr = new SpeciesReference(2,4); 328 assertEquals( false, (sr.hasRequiredAttributes()) ); 329 sr.setSpecies("sr"); 330 assertEquals( true, sr.hasRequiredAttributes() ); 331 sr = null; 332 } 333 test_SpeciesType()334 public void test_SpeciesType() 335 { 336 SpeciesType st = new SpeciesType(2,4); 337 assertEquals( false, (st.hasRequiredAttributes()) ); 338 st.setId("st"); 339 assertEquals( true, st.hasRequiredAttributes() ); 340 st = null; 341 } 342 test_Species_L1()343 public void test_Species_L1() 344 { 345 Species s = new Species(1,2); 346 assertEquals( false, (s.hasRequiredAttributes()) ); 347 s.setId("s"); 348 assertEquals( false, (s.hasRequiredAttributes()) ); 349 s.setCompartment("c"); 350 assertEquals( false, (s.hasRequiredAttributes()) ); 351 s.setInitialAmount(2); 352 assertEquals( true, s.hasRequiredAttributes() ); 353 s = null; 354 } 355 test_StoichiometryMath()356 public void test_StoichiometryMath() 357 { 358 StoichiometryMath sm = new StoichiometryMath(2,4); 359 assertEquals( true, sm.hasRequiredAttributes() ); 360 sm = null; 361 } 362 test_Trigger()363 public void test_Trigger() 364 { 365 Trigger t = new Trigger(2,4); 366 assertEquals( true, t.hasRequiredAttributes() ); 367 t = null; 368 } 369 test_Unit()370 public void test_Unit() 371 { 372 Unit u = new Unit(2,4); 373 assertEquals( false, (u.hasRequiredAttributes()) ); 374 u.setKind(libsbml.UNIT_KIND_MOLE); 375 assertEquals( true, u.hasRequiredAttributes() ); 376 u = null; 377 } 378 test_UnitDefinition()379 public void test_UnitDefinition() 380 { 381 UnitDefinition ud = new UnitDefinition(2,4); 382 assertEquals( false, (ud.hasRequiredAttributes()) ); 383 ud.setId("ud"); 384 assertEquals( true, ud.hasRequiredAttributes() ); 385 ud = null; 386 } 387 388 } 389 } 390 391