コード例 #1
0
ファイル: TestModel.cs プロジェクト: gitter-badger/sbmlsolver
        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()));
        }
コード例 #2
0
        public void test_AlgebraicRule_L1()
        {
            AlgebraicRule ar = new AlgebraicRule(1, 2);

            assertEquals(false, (ar.hasRequiredAttributes()));
            ar.setFormula("ar");
            assertEquals(true, ar.hasRequiredAttributes());
            ar = null;
        }
コード例 #3
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;
        }