END_TEST START_TEST (test_L3_Compartment_units) { const char *units = "volume"; fail_unless( !Compartment_isSetUnits(C) ); Compartment_setUnits(C, units); fail_unless( !strcmp(Compartment_getUnits(C), units) ); fail_unless( Compartment_isSetUnits(C) ); if (Compartment_getUnits(C) == units) { fail("Compartment_setUnits(...) did not make a copy of string."); } Compartment_unsetUnits(C); fail_unless( !Compartment_isSetUnits(C) ); if (Compartment_getUnits(C) != NULL) { fail("Compartment_unsetUnits(C, NULL) did not clear string."); } }
END_TEST START_TEST (test_Compartment_setUnits2) { int i = Compartment_setUnits(C, "litre"); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( Compartment_isSetUnits(C) ); i = Compartment_unsetUnits(C); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !Compartment_isSetUnits(C) ); }
END_TEST START_TEST (test_Compartment_setUnits1) { int i = Compartment_setUnits(C, "1cell"); fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE ); fail_unless( !Compartment_isSetUnits(C) ); i = Compartment_unsetUnits(C); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless( !Compartment_isSetUnits(C) ); }