public void test_Model_addEvent4() { Model m = new Model(2,2); Event e = new Event(2,2); Trigger t = new Trigger(2,2); e.setId( "e"); e.setTrigger(t); e.createEventAssignment(); Event e1 = new Event(2,2); e1.setId( "e"); e1.setTrigger(t); e1.createEventAssignment(); int i = m.addEvent(e); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumEvents() == 1 ); i = m.addEvent(e1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumEvents() == 1 ); e = null; e1 = null; m = null; }
public void test_Event_copyConstructor() { Event o1 = new Event(2,4); o1.setId("c"); assertTrue( o1.getId() == "c" ); Event o2 = new Event(o1); assertTrue( o2.getId() == "c" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_Event_clone() { Event o1 = new Event(2,4); o1.setId("c"); assertTrue( o1.getId() == "c" ); Event o2 = o1.clone(); assertTrue( o2.getId() == "c" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_Event_assignmentOperator() { Event o1 = new Event(2,4); o1.setId("c"); assertTrue( o1.getId() == "c" ); Event o2 = new Event(2,4); o2 = o1; assertTrue( o2.getId() == "c" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_Event_full() { ASTNode math1 = libsbml.parseFormula("0"); Trigger trigger = new Trigger(2,4); ASTNode math = libsbml.parseFormula("0"); Event e = new Event(2,4); EventAssignment ea = new EventAssignment(2,4); ea.setVariable( "k"); ea.setMath(math); trigger.setMath(math1); e.setTrigger(trigger); e.setId( "e1"); e.setName( "Set k2 to zero when P1 <= t"); e.addEventAssignment(ea); assertTrue( e.getNumEventAssignments() == 1 ); assertNotEquals(e.getEventAssignment(0),ea); math = null; e = null; }
public void test_Model_getEventById() { Event e1 = new Event(2,4); Event e2 = new Event(2,4); Trigger t = new Trigger(2,4); e1.setTrigger(t); e2.setTrigger(t); e1.createEventAssignment(); e2.createEventAssignment(); e1.setId( "e1" ); e2.setId( "e2" ); M.addEvent(e1); M.addEvent(e2); assertTrue( M.getNumEvents() == 2 ); assertNotEquals(M.getEvent( "e1" ),e1); assertNotEquals(M.getEvent( "e2" ),e2); assertEquals(M.getEvent( "e3" ),null); }