Inheritance: SBase
 public void setUp()
 {
     M = new  Model(2,4);
       if (M == null);
       {
       }
 }
 public void setUp()
 {
     string filename = "../../annotation/test/test-data/annotationL3.xml";
       d = libsbml.readSBML(filename);
       m = d.getModel();
       c = m.getCompartment(0);
 }
 public void test_CompartmentType_parent_create()
 {
     Model m = new Model(2,4);
       CompartmentType ct = m.createCompartmentType();
       ListOf lo = m.getListOfCompartmentTypes();
       assertTrue( lo == m.getCompartmentType(0).getParentSBMLObject() );
       assertTrue( lo == ct.getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_AssignmentRule_parent_create()
 {
     Model m = new Model(2,4);
       AssignmentRule r = m.createAssignmentRule();
       ListOf lo = m.getListOfRules();
       assertTrue( lo == m.getRule(0).getParentSBMLObject() );
       assertTrue( lo == r.getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_SBMLDocument_setLevelAndVersion()
 {
     SBMLDocument d = new  SBMLDocument(2,2);
       Model m1 = new  Model(2,2);
       d.setModel(m1);
       assertTrue( d.setLevelAndVersion(2,3,false) == true );
       assertTrue( d.setLevelAndVersion(2,1,false) == true );
       assertTrue( d.setLevelAndVersion(1,2,false) == true );
       assertTrue( d.setLevelAndVersion(1,1,false) == false );
       d = null;
 }
 public void test_CompartmentType_parent_add()
 {
     CompartmentType ct = new CompartmentType(2,4);
       Model m = new Model(2,4);
       ct.setId("ct");
       m.addCompartmentType(ct);
       ct = null;
       ListOf lo = m.getListOfCompartmentTypes();
       assertTrue( lo == m.getCompartmentType(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_Model_addCompartment2()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,1);
       c.setId( "c");
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumCompartments() == 0 );
       c = null;
       m = null;
 }
 public void test_Model_addCompartment1()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,2);
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       c.setId( "c");
       i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumCompartments() == 1 );
       c = null;
       m = null;
 }
Exemple #9
0
 public void test_CompartmentType_ancestor_add()
 {
     CompartmentType ct = new CompartmentType(2,4);
       Model m = new Model(2,4);
       ct.setId("ct");
       m.addCompartmentType(ct);
       ct = null;
       ListOf lo = m.getListOfCompartmentTypes();
       CompartmentType obj = m.getCompartmentType(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 );
 }
Exemple #10
0
 public void test_AssignmentRule_ancestor_create()
 {
     Model m = new Model(2,4);
       AssignmentRule r = m.createAssignmentRule();
       ListOf lo = m.getListOfRules();
       assertTrue( r.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( r.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( r.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( r.getAncestorOfType(libsbml.SBML_EVENT) == null );
       Rule obj = m.getRule(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_Model_createReactant()
 {
     Model m = new  Model(2,2);
       Reaction p = m.createReaction();
       SpeciesReference sr = m.createReactant();
       assertTrue( p.getNumReactants() == 1 );
       assertTrue( (sr).getLevel() == 2 );
       assertTrue( (sr).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createKineticLawParameters()
 {
     Model m = new  Model(2,2);
       Reaction r = m.createReaction();
       KineticLaw kl = m.createKineticLaw();
       Parameter p = m.createKineticLawParameter();
       assertTrue( r.isSetKineticLaw() == true );
       assertTrue( kl.getNumParameters() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createParameter()
 {
     Model m = new  Model(2,2);
       Parameter p = m.createParameter();
       assertTrue( m.getNumParameters() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createInitialAssignment()
 {
     Model m = new  Model(2,2);
       InitialAssignment p = m.createInitialAssignment();
       assertTrue( m.getNumInitialAssignments() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createKineticLaw()
 {
     Model m = new  Model(2,2);
       Reaction p = m.createReaction();
       KineticLaw kl = m.createKineticLaw();
       assertTrue( p.isSetKineticLaw() == true );
       assertTrue( (kl).getLevel() == 2 );
       assertTrue( (kl).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createConstraint()
 {
     Model m = new  Model(2,2);
       Constraint p = m.createConstraint();
       assertTrue( m.getNumConstraints() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createEventAssignment()
 {
     Model m = new  Model(2,2);
       Event p = m.createEvent();
       EventAssignment ea = m.createEventAssignment();
       assertTrue( p.getNumEventAssignments() == 1 );
       assertTrue( (ea).getLevel() == 2 );
       assertTrue( (ea).getVersion() == 2 );
       m = null;
 }
 public void test_Model_addSpeciesType2()
 {
     Model m = new  Model(2,2);
       SpeciesType st = new  SpeciesType(2,3);
       st.setId( "st");
       int i = m.addSpeciesType(st);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumSpeciesTypes() == 0 );
       st = null;
       m = null;
 }
 public void test_Model_createCompartmentType()
 {
     Model m = new  Model(2,2);
       CompartmentType p = m.createCompartmentType();
       assertTrue( m.getNumCompartmentTypes() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
Exemple #20
0
 public void test_SBase_setNotes()
 {
     SBase c = new Model(1,2);
       XMLToken token;
       XMLNode node;
       token = new  XMLToken("This is a test note");
       node = new XMLNode(token);
       c.setNotes(node);
       assertTrue( c.isSetNotes() == true );
       if (c.getNotes() == node);
       {
       }
       XMLNode t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       assertTrue((  "This is a test note" == t1.getChild(0).getCharacters() ));
       c.setNotes(c.getNotes());
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string chars = t1.getChild(0).getCharacters();
       assertTrue((  "This is a test note" == chars ));
       c.setNotes((XMLNode)null);
       assertTrue( c.isSetNotes() == false );
       if (c.getNotes() != null);
       {
       }
       c.setNotes(node);
       assertTrue( c.isSetNotes() == true );
       token = new  XMLToken("(CR) ¨ ¨ ¨ (NOT CR) &#; &#x; &#00a8; &#0168 &#x00a8");
       node = new XMLNode(token);
       c.setNotes(node);
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string s = t1.getChild(0).toXMLString();
       string expected =  "(CR) ¨ ¨ ¨ (NOT CR) &#; &#x; &#00a8; &#0168 &#x00a8";
       assertTrue(( expected == s ));
       token = new  XMLToken("& ' > < \" &amp; &apos; &gt; &lt; &quot;");
       node = new XMLNode(token);
       c.setNotes(node);
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string s2 = t1.getChild(0).toXMLString();
       string expected2 =  "&amp; &apos; &gt; &lt; &quot; &amp; &apos; &gt; &lt; &quot;";
       assertTrue(( expected2 == s2 ));
       token = null;
       node = null;
 }
 public void test_Model_createUnitDefinition()
 {
     Model m = new  Model(2,2);
       UnitDefinition p = m.createUnitDefinition();
       assertTrue( m.getNumUnitDefinitions() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_createRule()
 {
     Model m = new  Model(2,2);
       Rule p = m.createAssignmentRule();
       assertTrue( m.getNumRules() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_addSpeciesType4()
 {
     Model m = new  Model(2,2);
       SpeciesType st = new  SpeciesType(2,2);
       st.setId( "st");
       SpeciesType st1 = new  SpeciesType(2,2);
       st1.setId( "st");
       int i = m.addSpeciesType(st);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumSpeciesTypes() == 1 );
       i = m.addSpeciesType(st1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumSpeciesTypes() == 1 );
       st = null;
       st1 = null;
       m = null;
 }
 public void test_Model_addSpeciesType3()
 {
     Model m = new  Model(2,2);
       SpeciesType st = null;
       int i = m.addSpeciesType(st);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumSpeciesTypes() == 0 );
       m = null;
 }
 public void test_Model_createSpeciesType()
 {
     Model m = new  Model(2,2);
       SpeciesType p = m.createSpeciesType();
       assertTrue( m.getNumSpeciesTypes() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
 public void test_Model_addUnitDefinition3()
 {
     Model m = new  Model(2,2);
       UnitDefinition ud = new  UnitDefinition(1,2);
       ud.createUnit();
       ud.setId( "ud");
       int i = m.addUnitDefinition(ud);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumUnitDefinitions() == 0 );
       ud = null;
       m = null;
 }
 public void setUp()
 {
     string filename = "../../annotation/test/test-data/annotation2.xml";
       d2 = libsbml.readSBML(filename);
       m2 = d2.getModel();
 }
 public void test_Model_addUnitDefinition4()
 {
     Model m = new  Model(2,2);
       UnitDefinition ud = null;
       int i = m.addUnitDefinition(ud);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumUnitDefinitions() == 0 );
       m = null;
 }
Exemple #29
0
 public void test_SBase_setNotesString()
 {
     SBase c = new Model(1,2);
       string notes =  "This is a test note";
       string taggednotes =  "<notes>This is a test note</notes>";
       c.setNotes(notes);
       assertTrue( c.isSetNotes() == true );
       if (( taggednotes != c.getNotesString() ));
       {
       }
       XMLNode t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       XMLNode t2 = t1.getChild(0);
       assertTrue((  "This is a test note" == t2.getCharacters() ));
       c.setNotes(c.getNotesString());
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string chars = c.getNotesString();
       assertTrue(( taggednotes == chars ));
       c.setNotes( "");
       assertTrue( c.isSetNotes() == false );
       if (c.getNotesString() != null);
       {
       }
       c.setNotes(taggednotes);
       assertTrue( c.isSetNotes() == true );
       if (( taggednotes != c.getNotesString() ));
       {
       }
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       t2 = t1.getChild(0);
       assertTrue((  "This is a test note" == t2.getCharacters() ));
 }
 public void test_Model_addUnitDefinition5()
 {
     Model m = new  Model(2,2);
       UnitDefinition ud = new  UnitDefinition(2,2);
       ud.setId( "ud");
       ud.createUnit();
       UnitDefinition ud1 = new  UnitDefinition(2,2);
       ud1.setId( "ud");
       ud1.createUnit();
       int i = m.addUnitDefinition(ud);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumUnitDefinitions() == 1 );
       i = m.addUnitDefinition(ud1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumUnitDefinitions() == 1 );
       ud = null;
       ud1 = null;
       m = null;
 }