END_TEST


START_TEST (test_Event_addEventAssignment4)
{
  Event_t *e = Event_create(2, 2);
  EventAssignment_t *ea 
    = EventAssignment_create(2, 2);
  EventAssignment_setVariable(ea, "c");
  EventAssignment_setMath(ea, SBML_parseFormula("a-n"));
  EventAssignment_t *ea1 
    = EventAssignment_create(2, 2);
  EventAssignment_setVariable(ea1, "c");
  EventAssignment_setMath(ea1, SBML_parseFormula("a-n"));

  int i = Event_addEventAssignment(e, ea);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS);
  fail_unless( Event_getNumEventAssignments(e) == 1);

  i = Event_addEventAssignment(e, ea1);

  fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
  fail_unless( Event_getNumEventAssignments(e) == 1);  
  
  EventAssignment_free(ea);
  EventAssignment_free(ea1);
  Event_free(e);
}
void
EventAssignmentTest1_setup (void)
{
  E = EventAssignment_create(2, 4);

  if (E == NULL)
  {
    fail("EventAssignment_create() returned a NULL pointer.");
  }
}
예제 #3
0
파일: doc.c 프로젝트: cran/rsbml
static EventAssignment_t *
rsbml_build_doc_event_assignment(SEXP r_event_assignment)
{
  EventAssignment_t * event_assignment;
  
  event_assignment = EventAssignment_create();
  
  rsbml_build_doc_s_base((SBase_t *)event_assignment, r_event_assignment);
  
  SET_ATTR(EventAssignment, event_assignment, Variable, variable, STRING);
  SET_ATTR(EventAssignment, event_assignment, Math, math, EXPRESSION);
  
  return event_assignment;
}
END_TEST


START_TEST (test_Event_addEventAssignment2)
{
  Event_t *e = Event_create(2, 2);
  EventAssignment_t *ea 
    = EventAssignment_create(2, 3);
  EventAssignment_setVariable(ea, "f");
  EventAssignment_setMath(ea, SBML_parseFormula("a-n"));

  int i = Event_addEventAssignment(e, ea);

  fail_unless( i == LIBSBML_VERSION_MISMATCH);
  fail_unless( Event_getNumEventAssignments(e) == 0);

  EventAssignment_free(ea);
  Event_free(e);
}