public void test_AlgebraicRule_L1()
 {
     AlgebraicRule ar = new AlgebraicRule(1,2);
       assertEquals( false, (ar.hasRequiredAttributes()) );
       ar.setFormula("ar");
       assertEquals( true, ar.hasRequiredAttributes() );
       ar = null;
 }
Esempio n. 2
0
 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;
 }
 public void test_internal_consistency_check_99904_rule_alg()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Rule r = new AlgebraicRule(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       r.setMetaId("mmm");
       r.setFormula("2");
       m.addRule(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Esempio n. 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() ));
 }