END_TEST START_TEST (test_InitialAssignment_setSymbol) { const char *Symbol = "k2"; InitialAssignment_setSymbol(IA, Symbol); fail_unless( !strcmp(InitialAssignment_getSymbol(IA), Symbol) ); fail_unless( InitialAssignment_isSetSymbol(IA) ); if (InitialAssignment_getSymbol(IA) == Symbol) { fail("InitialAssignment_setSymbol(...) did not make a copy of string."); } /* Reflexive case (pathological) */ InitialAssignment_setSymbol(IA, InitialAssignment_getSymbol(IA)); fail_unless( !strcmp(InitialAssignment_getSymbol(IA), Symbol) ); InitialAssignment_setSymbol(IA, NULL); fail_unless( !InitialAssignment_isSetSymbol(IA) ); if (InitialAssignment_getSymbol(IA) != NULL) { fail("InitialAssignment_setSymbol(IA, NULL) did not clear string."); } }
END_TEST START_TEST (test_InitialAssignment_setSymbol2) { const char *id = "e1"; int i = InitialAssignment_setSymbol(E, id); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !strcmp(InitialAssignment_getSymbol(E), id) ); fail_unless( InitialAssignment_isSetSymbol(E) ); i = InitialAssignment_setSymbol(E, NULL); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !InitialAssignment_isSetSymbol(E) ); }