示例#1
0
void
L3TriggerTest_setup (void)
{
  T = Trigger_create(3, 1);

  if (T == NULL)
  {
    fail("Trigger_create() returned a NULL pointer.");
  }
}
void
TriggerTest_setup (void)
{
    D = Trigger_create(2, 4);

    if (D == NULL)
    {
        fail("Trigger_create() returned a NULL pointer.");
    }
}
END_TEST


START_TEST (test_Event_setTrigger1)
{
  Trigger_t   *trigger 
    = Trigger_create(2, 1);
  Trigger_setMath(trigger, SBML_parseFormula("true"));
 
  int i = Event_setTrigger(E, trigger);

  fail_unless( i == LIBSBML_VERSION_MISMATCH );
  fail_unless( !Event_isSetTrigger(E) );

}
示例#4
0
END_TEST


START_TEST (test_L3Trigger_setPersistent1)
{
  Trigger_t *t = Trigger_create(2, 4);

  int i = Trigger_setPersistent(t, 0);

  fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );
 
  fail_unless( Trigger_getPersistent(T) == 1 );
  fail_unless( Trigger_isSetPersistent(T) == 0 );

  Trigger_free(t);
}
示例#5
0
END_TEST


START_TEST (test_L3_Event_hasRequiredElements )
{
  Event_t *e = Event_create (3, 1);

  fail_unless ( !Event_hasRequiredElements(e));

  Trigger_t *t = Trigger_create(3, 1);
  Event_setTrigger(e, t);

  fail_unless ( Event_hasRequiredElements(e));

  Event_free(e);
}
END_TEST


START_TEST (test_Event_setTrigger2)
{
  ASTNode_t         *math1   = SBML_parseFormula("0");
  Trigger_t   *trigger 
    = Trigger_create(2, 4);
  Trigger_setMath(trigger, math1);
 
  int i = Event_setTrigger(E, trigger);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( Event_getTrigger(E) != NULL );
  fail_unless( Event_isSetTrigger(E) );

}
示例#7
0
END_TEST


START_TEST (test_L3_Event_hasRequiredElements )
{
  Event_t *e = Event_create (3, 1);

  fail_unless ( !Event_hasRequiredElements(e));

  Trigger_t *t = Trigger_create(3, 1);
  ASTNode_t* math = SBML_parseFormula("true");
  Trigger_setMath(t, math);
  ASTNode_free(math);
  Trigger_setInitialValue(t, 1);
  Trigger_setPersistent(t, 1);
  Event_setTrigger(e, t);

  fail_unless ( Event_hasRequiredElements(e));

  Event_free(e);
  Trigger_free(t);
}
END_TEST


START_TEST (test_L3Trigger_setInitialValue1)
{
    Trigger_t *t = Trigger_create(2, 4);

    int i = Trigger_setInitialValue(t, 0);

    fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );

    fail_unless( Trigger_getInitialValue(T) == 1 );
    fail_unless( Trigger_isSetInitialValue(T) == 0 );

    i = Trigger_unsetInitialValue(t);

    fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );

    fail_unless( Trigger_getInitialValue(T) == 1 );
    fail_unless( Trigger_isSetInitialValue(T) == 0 );

    Trigger_free(t);
}