public void test_AssignmentRule() { AssignmentRule r = new AssignmentRule(2,4); assertEquals( false, (r.hasRequiredElements()) ); r.setMath(libsbml.parseFormula("ar")); assertEquals( true, r.hasRequiredElements() ); r = null; }
public void test_Model_addRule5() { Model m = new Model(2,2); Rule ar = new AssignmentRule(2,2); ar.setVariable( "ar"); ar.setMath(libsbml.parseFormula("a-j")); Rule ar1 = new AssignmentRule(2,2); ar1.setVariable( "ar"); ar1.setMath(libsbml.parseFormula("a-j")); int i = m.addRule(ar); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumRules() == 1 ); i = m.addRule(ar1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumRules() == 1 ); ar = null; ar1 = null; m = null; }
public void test_Model_addRule3() { Model m = new Model(2,2); Rule r = new AssignmentRule(1,2); r.setVariable( "f"); r.setMath(libsbml.parseFormula("a-n")); int i = m.addRule(r); assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH ); assertTrue( m.getNumRules() == 0 ); r = null; m = null; }
public void test_Model_addRule1() { Model m = new Model(2,2); Rule r = new AssignmentRule(2,2); int i = m.addRule(r); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); r.setVariable( "f"); i = m.addRule(r); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); r.setMath(libsbml.parseFormula("a-n")); i = m.addRule(r); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumRules() == 1 ); r = null; m = null; }
public void test_Model_addRules() { Rule r1 = new AlgebraicRule(2,4); Rule r2 = new AssignmentRule(2,4); Rule r3 = new RateRule(2,4); r2.setVariable( "r2"); r3.setVariable( "r3"); r1.setMath(libsbml.parseFormula("2")); r2.setMath(libsbml.parseFormula("2")); r3.setMath(libsbml.parseFormula("2")); M.addRule(r1); M.addRule(r2); M.addRule(r3); assertTrue( M.getNumRules() == 3 ); }
public void test_AssignmentRule_createWithMath() { ASTNode math = libsbml.parseFormula("1 + 1"); Rule ar = new AssignmentRule(2,4); ar.setVariable( "s"); ar.setMath(math); assertTrue( ar.getTypeCode() == libsbml.SBML_ASSIGNMENT_RULE ); assertTrue( ar.getMetaId() == "" ); assertTrue(( "s" == ar.getVariable() )); assertTrue(( "1 + 1" == ar.getFormula() )); assertTrue( ar.getMath() != math ); ar = null; }