public void test_StoichiometryMath() { StoichiometryMath sm = new StoichiometryMath(2, 4); assertEquals(false, (sm.hasRequiredElements())); sm.setMath(libsbml.parseFormula("ar")); assertEquals(true, sm.hasRequiredElements()); sm = null; }
public void setUp() { D = new StoichiometryMath(2, 4); if (D == null) { ; } { } }
public void test_SpeciesReference_setStoichiometryMath6() { StoichiometryMath sm = new StoichiometryMath(2, 1); sm.setMath(libsbml.parseFormula("1")); int i = sr.setStoichiometryMath(sm); assertTrue(i == libsbml.LIBSBML_VERSION_MISMATCH); assertEquals(false, sr.isSetStoichiometryMath()); sm = null; }
public void test_StoichiometryMath_parent_add() { StoichiometryMath m = new StoichiometryMath(2, 4); m.setMath(libsbml.parseFormula("1")); SpeciesReference sr = new SpeciesReference(2, 4); sr.setStoichiometryMath(m); m = null; assertTrue(sr == sr.getStoichiometryMath().getParentSBMLObject()); sr = null; }
public void test_StoichiometryMath_ancestor_create() { SpeciesReference sr = new SpeciesReference(2, 4); StoichiometryMath sm = sr.createStoichiometryMath(); assertTrue(sm.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr); assertTrue(sm.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); assertTrue(sm.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null); StoichiometryMath obj = sr.getStoichiometryMath(); assertTrue(obj.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr); assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); assertTrue(obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null); }
public void test_SpeciesReference_setStoichiometryMath2() { StoichiometryMath sm = new StoichiometryMath(2, 4); ASTNode math = new ASTNode(libsbml.AST_TIMES); ASTNode a = new ASTNode(); a.setName("a"); math.addChild(a); sm.setMath(math); int i = sr.setStoichiometryMath(sm); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertEquals(true, sr.isSetStoichiometryMath()); sm = null; }
public void test_SpeciesReference_setStoichiometryMath4() { StoichiometryMath sm = new StoichiometryMath(2, 4); ASTNode math = null; sm.setMath(math); int i = sr.setStoichiometryMath(sm); assertTrue(i == libsbml.LIBSBML_INVALID_OBJECT); assertEquals(false, sr.isSetStoichiometryMath()); assertTrue(sr.getStoichiometry() == 1); i = sr.unsetStoichiometryMath(); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertEquals(false, sr.isSetStoichiometryMath()); sm = null; }
public void test_StoichiometryMath_ancestor_add() { StoichiometryMath m = new StoichiometryMath(2, 4); m.setMath(libsbml.parseFormula("1")); SpeciesReference sr = new SpeciesReference(2, 4); sr.setStoichiometryMath(m); m = null; StoichiometryMath obj = sr.getStoichiometryMath(); assertTrue(obj.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr); assertTrue(obj.getAncestorOfType(libsbml.SBML_MODEL) == null); assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); sr = null; }
public void test_SpeciesReference_setStoichiometryMath() { ASTNode math = libsbml.parseFormula("k3 / k2"); StoichiometryMath stoich = new StoichiometryMath(2, 4); stoich.setMath(math); StoichiometryMath math1; string formula; SR.setStoichiometryMath(stoich); math1 = SR.getStoichiometryMath(); assertTrue(math1 != null); formula = libsbml.formulaToString(math1.getMath()); assertTrue(formula != null); assertTrue(("k3 / k2" == formula)); assertEquals(true, SR.isSetStoichiometryMath()); }
public void test_SpeciesReference_setStoichiometryMath5() { SpeciesReference sr1 = new SpeciesReference(1, 2); StoichiometryMath sm = new StoichiometryMath(2, 4); ASTNode math = new ASTNode(libsbml.AST_TIMES); ASTNode a = new ASTNode(); ASTNode b = new ASTNode(); a.setName("a"); b.setName("b"); math.addChild(a); math.addChild(b); sm.setMath(math); int i = sr1.setStoichiometryMath(sm); assertTrue(i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE); assertEquals(false, sr1.isSetStoichiometryMath()); sm = null; sr1 = null; }
public void test_StoichiometryMath_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2, 1); sbmlns.addNamespaces(xmlns); StoichiometryMath object1 = new StoichiometryMath(sbmlns); assertTrue(object1.getTypeCode() == libsbml.SBML_STOICHIOMETRY_MATH); assertTrue(object1.getMetaId() == ""); assertTrue(object1.getNotes() == null); assertTrue(object1.getAnnotation() == null); assertTrue(object1.getLevel() == 2); assertTrue(object1.getVersion() == 1); assertTrue(object1.getNamespaces() != null); assertTrue(object1.getNamespaces().getLength() == 2); object1 = null; }
static void testClone(SBase s) { string ename = s.getElementName(); SBase c = s.clone(); if (c is Compartment) { Compartment x = (s as Compartment).clone(); c = x; } else if (c is CompartmentType) { CompartmentType x = (s as CompartmentType).clone(); c = x; } else if (c is Constraint) { Constraint x = (s as Constraint).clone(); c = x; } else if (c is Delay) { Delay x = (s as Delay).clone(); c = x; } else if (c is Event) { Event x = (s as Event).clone(); c = x; } else if (c is EventAssignment) { EventAssignment x = (s as EventAssignment).clone(); c = x; } else if (c is FunctionDefinition) { FunctionDefinition x = (s as FunctionDefinition).clone(); c = x; } else if (c is InitialAssignment) { InitialAssignment x = (s as InitialAssignment).clone(); c = x; } else if (c is KineticLaw) { KineticLaw x = (s as KineticLaw).clone(); c = x; } // currently return type of ListOf::clone() is SBase else if (c is ListOf) { SBase x = (s as ListOf).clone(); c = x; } else if (c is Model) { Model x = (s as Model).clone(); c = x; } else if (c is Parameter) { Parameter x = (s as Parameter).clone(); c = x; } else if (c is Reaction) { Reaction x = (s as Reaction).clone(); c = x; } else if (c is AlgebraicRule) { AlgebraicRule x = (s as AlgebraicRule).clone(); c = x; } else if (c is AssignmentRule) { AssignmentRule x = (s as AssignmentRule).clone(); c = x; } else if (c is RateRule) { RateRule x = (s as RateRule).clone(); c = x; } else if (c is SBMLDocument) { SBMLDocument x = (s as SBMLDocument).clone(); c = x; } else if (c is Species) { Species x = (s as Species).clone(); c = x; } else if (c is SpeciesReference) { SpeciesReference x = (s as SpeciesReference).clone(); c = x; } else if (c is SpeciesType) { SpeciesType x = (s as SpeciesType).clone(); c = x; } else if (c is SpeciesReference) { SpeciesReference x = (s as SpeciesReference).clone(); c = x; } else if (c is StoichiometryMath) { StoichiometryMath x = (s as StoichiometryMath).clone(); c = x; } else if (c is Trigger) { Trigger x = (s as Trigger).clone(); c = x; } else if (c is Unit) { Unit x = (s as Unit).clone(); c = x; } else if (c is UnitDefinition) { UnitDefinition x = (s as UnitDefinition).clone(); c = x; } else if (c is ListOfCompartmentTypes) { ListOfCompartmentTypes x = (s as ListOfCompartmentTypes).clone(); c = x; } else if (c is ListOfCompartments) { ListOfCompartments x = (s as ListOfCompartments).clone(); c = x; } else if (c is ListOfConstraints) { ListOfConstraints x = (s as ListOfConstraints).clone(); c = x; } else if (c is ListOfEventAssignments) { ListOfEventAssignments x = (s as ListOfEventAssignments).clone(); c = x; } else if (c is ListOfEvents) { ListOfEvents x = (s as ListOfEvents).clone(); c = x; } else if (c is ListOfFunctionDefinitions) { ListOfFunctionDefinitions x = (s as ListOfFunctionDefinitions).clone(); c = x; } else if (c is ListOfInitialAssignments) { ListOfInitialAssignments x = (s as ListOfInitialAssignments).clone(); c = x; } else if (c is ListOfParameters) { ListOfParameters x = (s as ListOfParameters).clone(); c = x; } else if (c is ListOfReactions) { ListOfReactions x = (s as ListOfReactions).clone(); c = x; } else if (c is ListOfRules) { ListOfRules x = (s as ListOfRules).clone(); c = x; } else if (c is ListOfSpecies) { ListOfSpecies x = (s as ListOfSpecies).clone(); c = x; } else if (c is ListOfSpeciesReferences) { ListOfSpeciesReferences x = (s as ListOfSpeciesReferences).clone(); c = x; } else if (c is ListOfSpeciesTypes) { ListOfSpeciesTypes x = (s as ListOfSpeciesTypes).clone(); c = x; } else if (c is ListOfUnitDefinitions) { ListOfUnitDefinitions x = (s as ListOfUnitDefinitions).clone(); c = x; } else if (c is ListOfUnits) { ListOfUnits x = (s as ListOfUnits).clone(); c = x; } else { ERR("[testClone] Error: (" + ename + ") : clone() failed."); return; } if (c == null) { ERR("[testClone] Error: (" + ename + ") : clone() failed."); return; } string enameClone = c.getElementName(); if (ename == enameClone) { //Console.Out.WriteLine("[testClone] OK: (" + ename + ") clone(" + enameClone + ") : type match."); OK(); } else { ERR("[testClone] Error: (" + ename + ") clone(" + enameClone + ") : type mismatch."); } }
public void tearDown() { D = null; }