public void test_Model_getRules() { Rule ar = new AlgebraicRule(2, 4); Rule scr = new AssignmentRule(2, 4); Rule cvr = new AssignmentRule(2, 4); Rule pr = new AssignmentRule(2, 4); scr.setVariable("r2"); cvr.setVariable("r3"); pr.setVariable("r4"); ar.setFormula("x + 1"); scr.setFormula("k * t/(1 + k)"); cvr.setFormula("0.10 * t"); pr.setFormula("k3/k2"); M.addRule(ar); M.addRule(scr); M.addRule(cvr); M.addRule(pr); assertTrue(M.getNumRules() == 4); ar = M.getRule(0); scr = M.getRule(1); cvr = M.getRule(2); pr = M.getRule(3); assertTrue(("x + 1" == ar.getFormula())); assertTrue(("k * t/(1 + k)" == scr.getFormula())); assertTrue(("0.10 * t" == cvr.getFormula())); assertTrue(("k3/k2" == pr.getFormula())); }
public void test_AlgebraicRule_createWithMath() { ASTNode math = libsbml.parseFormula("1 + 1"); Rule ar = new AlgebraicRule(2, 4); ar.setMath(math); assertTrue(ar.getTypeCode() == libsbml.SBML_ALGEBRAIC_RULE); assertTrue(ar.getMetaId() == ""); assertTrue(("1 + 1" == ar.getFormula())); assertTrue(ar.getMath() != math); ar = null; }
public void test_AlgebraicRule_createWithFormula() { ASTNode math; string formula; Rule ar = new AlgebraicRule(2, 4); ar.setFormula("1 + 1"); assertTrue(ar.getTypeCode() == libsbml.SBML_ALGEBRAIC_RULE); assertTrue(ar.getMetaId() == ""); math = ar.getMath(); assertTrue(math != null); formula = libsbml.formulaToString(math); assertTrue(formula != null); assertTrue(("1 + 1" == formula)); assertTrue((formula == ar.getFormula())); ar = null; }