public void test_AssignmentRule_L1()
 {
     AssignmentRule r = new AssignmentRule(1,2);
       assertEquals( false, (r.hasRequiredAttributes()) );
       r.setVariable("r");
       assertEquals( false, (r.hasRequiredAttributes()) );
       r.setFormula("r");
       assertEquals( true, r.hasRequiredAttributes() );
       r = null;
 }
 public void test_AssignmentRule_createWithFormula()
 {
     ASTNode math;
       string formula;
       Rule ar = new  AssignmentRule(2,4);
       ar.setVariable( "s");
       ar.setFormula( "1 + 1");
       assertTrue( ar.getTypeCode() == libsbml.SBML_ASSIGNMENT_RULE );
       assertTrue( ar.getMetaId() == "" );
       assertTrue((  "s" == ar.getVariable() ));
       math = ar.getMath();
       assertTrue( math != null );
       formula = libsbml.formulaToString(math);
       assertTrue( formula != null );
       assertTrue((  "1 + 1" == formula ));
       assertTrue(( formula == ar.getFormula() ));
       ar = null;
 }
 public void test_internal_consistency_check_99904_rule_assign()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Rule r = new AssignmentRule(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       c.setConstant(false);
       r.setVariable("cc");
       r.setFormula("2");
       r.setMetaId("mmm");
       m.addRule(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Beispiel #4
0
 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() ));
 }