public void test_WriteSBML_Event_full() { string expected = "<event id=\"e\">\n" + " <trigger>\n" + " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" + " <apply>\n" + " <leq/>\n" + " <ci> P1 </ci>\n" + " <ci> t </ci>\n" + " </apply>\n" + " </math>\n" + " </trigger>\n" + " <listOfEventAssignments>\n" + " <eventAssignment sboTerm=\"SBO:0000064\" variable=\"k2\">\n" + " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" + " <cn type=\"integer\"> 0 </cn>\n" + " </math>\n" + " </eventAssignment>\n" + " </listOfEventAssignments>\n" + "</event>"; D.setLevelAndVersion(2,3,false); Event e = D.createModel().createEvent(); e.setId("e"); ASTNode node = libsbml.parseFormula("leq(P1,t)"); Trigger t = new Trigger ( 2,3 ); t.setMath(node); ASTNode math = libsbml.parseFormula("0"); EventAssignment ea = new EventAssignment ( 2,3 ); ea.setVariable("k2"); ea.setMath(math); ea.setSBOTerm(64); e.setTrigger(t); e.addEventAssignment(ea); assertEquals( true, equals(expected,e.toSBML()) ); }
public void test_internal_consistency_check_99911_ea() { SBMLDocument d = new SBMLDocument(2,4); d.setLevelAndVersion(2,1,false); long errors; Model m = d.createModel(); Compartment c = m.createCompartment(); c.setId("c"); c.setConstant(false); Event e = m.createEvent(); ASTNode ast = libsbml.parseFormula("2*x"); Trigger t = e.createTrigger(); t.setMath(ast); EventAssignment ea = new EventAssignment(2,4); ea.setVariable("c"); ea.setSBOTerm(2); ea.setMath(ast); e.addEventAssignment(ea); errors = d.checkInternalConsistency(); assertTrue( errors == 1 ); assertTrue( d.getError(0).getErrorId() == 21203 ); d = null; }