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 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_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_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_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_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_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; }