END_TEST START_TEST (test_Reaction_setId) { const char *id = "J1"; Reaction_setId(R, id); fail_unless( !strcmp(Reaction_getId(R), id) ); fail_unless( Reaction_isSetId(R) ); if (Reaction_getId(R) == id) { fail("Reaction_setId(...) did not make a copy of string."); } /* Reflexive case (pathological) */ Reaction_setId(R, Reaction_getId(R)); fail_unless( !strcmp(Reaction_getId(R), id) ); Reaction_setId(R, NULL); fail_unless( !Reaction_isSetId(R) ); if (Reaction_getId(R) != NULL) { fail("Reaction_setId(R, NULL) did not clear string."); } }
END_TEST START_TEST (test_Reaction_setId2) { int i = Reaction_setId(R, "cell"); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( Reaction_isSetId(R) ); fail_unless( !strcmp(Reaction_getId(R), "cell" )); i = Reaction_setId(R, NULL); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !Reaction_isSetId(R) ); }