END_TEST START_TEST (test_SpeciesType_setId) { char *id = "mitochondria"; SpeciesType_setId(CT, id); fail_unless( !strcmp(SpeciesType_getId(CT), id) ); fail_unless( SpeciesType_isSetId(CT) ); if (SpeciesType_getId(CT) == id) { fail("SpeciesType_setId(...) did not make a copy of string."); } /* Reflexive case (pathological) */ SpeciesType_setId(CT, SpeciesType_getId(CT)); fail_unless( !strcmp(SpeciesType_getId(CT), id) ); SpeciesType_setId(CT, NULL); fail_unless( !SpeciesType_isSetId(CT) ); if (SpeciesType_getId(CT) != NULL) { fail("SpeciesType_setId(CT, NULL) did not clear string."); } }
END_TEST START_TEST (test_SpeciesType_setId4) { int i = SpeciesType_setId(ST, "cell"); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( SpeciesType_isSetId(ST) ); fail_unless( !strcmp(SpeciesType_getId(ST), "cell" )); i = SpeciesType_setId(ST, NULL); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !SpeciesType_isSetId(ST) ); }