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);
}
END_TEST


//START_TEST (test_EventAssignment_createWith)
//{
//  ASTNode_t         *math = SBML_parseFormula("0");
//  EventAssignment_t *ea   = EventAssignment_createWithVarAndMath("k", math);
//
//  fail_unless( SBase_getTypeCode  ((SBase_t *) ea) == SBML_EVENT_ASSIGNMENT );
//  fail_unless( SBase_getMetaId    ((SBase_t *) ea) == NULL );
//  fail_unless( SBase_getNotes     ((SBase_t *) ea) == NULL );
//  fail_unless( SBase_getAnnotation((SBase_t *) ea) == NULL );
//
//  fail_unless( EventAssignment_getMath(ea) != math );
//  fail_unless( EventAssignment_isSetMath(ea) );
//
//  fail_unless( !strcmp(EventAssignment_getVariable(ea), "k") );
//  fail_unless( EventAssignment_isSetVariable(ea) );
//
//  ASTNode_free(math);
//  EventAssignment_free(ea);
//}
//END_TEST


START_TEST (test_EventAssignment_free_NULL)
{
  EventAssignment_free(NULL);
}
END_TEST


START_TEST (test_EventAssignment_createWithNS )
{
  XMLNamespaces_t *xmlns = XMLNamespaces_create();
  XMLNamespaces_add(xmlns, "http://www.sbml.org", "testsbml");
  SBMLNamespaces_t *sbmlns = SBMLNamespaces_create(2,1);
  SBMLNamespaces_addNamespaces(sbmlns,xmlns);

  EventAssignment_t *object = 
    EventAssignment_createWithNS (sbmlns);


  fail_unless( SBase_getTypeCode  ((SBase_t *) object) == SBML_EVENT_ASSIGNMENT );
  fail_unless( SBase_getMetaId    ((SBase_t *) object) == NULL );
  fail_unless( SBase_getNotes     ((SBase_t *) object) == NULL );
  fail_unless( SBase_getAnnotation((SBase_t *) object) == NULL );

  fail_unless( SBase_getLevel       ((SBase_t *) object) == 2 );
  fail_unless( SBase_getVersion     ((SBase_t *) object) == 1 );

  fail_unless( EventAssignment_getNamespaces     (object) != NULL );
  fail_unless( XMLNamespaces_getLength(
                        EventAssignment_getNamespaces(object)) == 2 );

  EventAssignment_free(object);
  XMLNamespaces_free(xmlns);
  SBMLNamespaces_free(sbmlns);
}
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);
}
void
EventAssignmentTest1_teardown (void)
{
  EventAssignment_free(E);
}