public void test_InitialAssignment_ancestor_add() { InitialAssignment ia = new InitialAssignment(2,4); Model m = new Model(2,4); ia.setSymbol("c"); ia.setMath(libsbml.parseFormula("9")); m.addInitialAssignment(ia); ia = null; ListOf lo = m.getListOfInitialAssignments(); InitialAssignment obj = m.getInitialAssignment(0); assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m ); assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null ); }
public void test_InitialAssignment_parent_add() { InitialAssignment ia = new InitialAssignment(2,4); Model m = new Model(2,4); ia.setSymbol("c"); ia.setMath(libsbml.parseFormula("9")); m.addInitialAssignment(ia); ia = null; ListOf lo = m.getListOfInitialAssignments(); assertTrue( lo == m.getInitialAssignment(0).getParentSBMLObject() ); assertTrue( m == lo.getParentSBMLObject() ); }
public void test_Model_addInitialAssignment4() { Model m = new Model(2,2); InitialAssignment ia = new InitialAssignment(2,2); ia.setSymbol( "ia"); ia.setMath(libsbml.parseFormula("a+b")); InitialAssignment ia1 = new InitialAssignment(2,2); ia1.setSymbol( "ia"); ia1.setMath(libsbml.parseFormula("a+b")); int i = m.addInitialAssignment(ia); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumInitialAssignments() == 1 ); i = m.addInitialAssignment(ia1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumInitialAssignments() == 1 ); ia = null; ia1 = null; m = null; }
public void test_Model_addInitialAssignment2() { Model m = new Model(2,2); InitialAssignment ia = new InitialAssignment(2,3); ia.setSymbol( "i"); ia.setMath(libsbml.parseFormula("gg")); int i = m.addInitialAssignment(ia); assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH ); assertTrue( m.getNumInitialAssignments() == 0 ); ia = null; m = null; }
public void test_Model_addInitialAssignment1() { Model m = new Model(2,2); InitialAssignment ia = new InitialAssignment(2,2); int i = m.addInitialAssignment(ia); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); ia.setSymbol( "i"); i = m.addInitialAssignment(ia); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); ia.setMath(libsbml.parseFormula("gg")); i = m.addInitialAssignment(ia); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumInitialAssignments() == 1 ); ia = null; m = null; }
public void test_InitialAssignment() { InitialAssignment ia = new InitialAssignment(2,4); assertEquals( false, (ia.hasRequiredAttributes()) ); ia.setSymbol("ia"); assertEquals( true, ia.hasRequiredAttributes() ); ia = null; }
public void test_InitialAssignment_copyConstructor() { InitialAssignment o1 = new InitialAssignment(2,4); o1.setSymbol("c"); assertTrue( o1.getId() == "c" ); InitialAssignment o2 = new InitialAssignment(o1); assertTrue( o2.getId() == "c" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }