From: <sar...@us...> - 2008-12-02 19:28:03
|
Revision: 8480 http://sbml.svn.sourceforge.net/sbml/?rev=8480&view=rev Author: sarahkeating Date: 2008-12-02 19:27:53 +0000 (Tue, 02 Dec 2008) Log Message: ----------- standardised the C implementation of set functions that set strings is called with a NULL pointer These now all 1) unset the variable concerned 2) return LIBSBML_OPERATION_SUCCESS 3) include a note in the documentation stating that using teh function with a NULL pointer will unset the variable All these functions have tests. Modified Paths: -------------- branches/libsbml-new-api-3.3/src/sbml/Compartment.cpp branches/libsbml-new-api-3.3/src/sbml/CompartmentType.cpp branches/libsbml-new-api-3.3/src/sbml/Event.cpp branches/libsbml-new-api-3.3/src/sbml/EventAssignment.cpp branches/libsbml-new-api-3.3/src/sbml/FunctionDefinition.cpp branches/libsbml-new-api-3.3/src/sbml/InitialAssignment.cpp branches/libsbml-new-api-3.3/src/sbml/KineticLaw.cpp branches/libsbml-new-api-3.3/src/sbml/Model.cpp branches/libsbml-new-api-3.3/src/sbml/Parameter.cpp branches/libsbml-new-api-3.3/src/sbml/Reaction.cpp branches/libsbml-new-api-3.3/src/sbml/Rule.cpp branches/libsbml-new-api-3.3/src/sbml/SBase.cpp branches/libsbml-new-api-3.3/src/sbml/Species.cpp branches/libsbml-new-api-3.3/src/sbml/SpeciesReference.cpp branches/libsbml-new-api-3.3/src/sbml/SpeciesType.cpp branches/libsbml-new-api-3.3/src/sbml/UnitDefinition.cpp branches/libsbml-new-api-3.3/src/sbml/test/TestCompartmentType_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestCompartment_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestEvent_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestFunctionDefinition_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestKineticLaw_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestModel_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestParameter_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestReaction_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestRule_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestSBase_newSetters.cpp branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesReference_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesType_newSetters.c branches/libsbml-new-api-3.3/src/sbml/test/TestSpecies_newSetters.c Modified: branches/libsbml-new-api-3.3/src/sbml/Compartment.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Compartment.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Compartment.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1368,6 +1368,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1395,6 +1398,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int @@ -1423,6 +1429,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "compartmentType" attribute. */ LIBSBML_EXTERN int @@ -1531,6 +1540,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "units" attribute. */ LIBSBML_EXTERN int @@ -1555,6 +1567,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "outside" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/CompartmentType.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/CompartmentType.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/CompartmentType.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -548,6 +548,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -572,6 +575,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/Event.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Event.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Event.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1252,6 +1252,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1274,6 +1277,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int @@ -1350,6 +1356,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "timeUnits" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/EventAssignment.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/EventAssignment.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/EventAssignment.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -778,6 +778,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "variable" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/FunctionDefinition.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/FunctionDefinition.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/FunctionDefinition.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -833,12 +833,15 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int FunctionDefinition_setId (FunctionDefinition_t *fd, const char *sid) { - return fd->setId(sid ? sid : ""); + return (sid == NULL) ? fd->unsetId() : fd->setId(sid); } @@ -856,6 +859,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/InitialAssignment.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/InitialAssignment.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/InitialAssignment.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -750,6 +750,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "symbol" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/KineticLaw.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/KineticLaw.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/KineticLaw.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1405,6 +1405,9 @@ * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "timeUnits" attribute. + * * @warning In SBML Level 2 Version 2, the "timeUnits" and "substanceUnits" * attributes were removed. For compatibility with new versions of SBML, * users are cautioned to avoid these attributes. @@ -1435,6 +1438,9 @@ * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "substanceUnits" attribute. + * * @warning In SBML Level 2 Version 2, the "timeUnits" and "substanceUnits" * attributes were removed. For compatibility with new versions of SBML, * users are cautioned to avoid these attributes. Modified: branches/libsbml-new-api-3.3/src/sbml/Model.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Model.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Model.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -3558,6 +3558,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -3582,6 +3585,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/Parameter.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Parameter.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Parameter.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -998,6 +998,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1022,6 +1025,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int @@ -1067,6 +1073,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with units set to NULL is equivalent to + * unsetting the "units" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/Reaction.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Reaction.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Reaction.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1440,6 +1440,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1459,6 +1462,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/Rule.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Rule.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Rule.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1778,6 +1778,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "variable" attribute. */ LIBSBML_EXTERN int @@ -1799,6 +1802,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "units" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/SBase.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/SBase.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/SBase.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -525,6 +525,11 @@ { return LIBSBML_UNEXPECTED_ATTRIBUTE; } + else if (metaid.empty()) + { + mMetaId.erase(); + return LIBSBML_OPERATION_SUCCESS; + } else if (!(SBase::hasCorrectMetaIdSyntax(metaid))) { return LIBSBML_INVALID_ATTRIBUTE_VALUE; @@ -4867,6 +4872,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with the metaid set to NULL is equivalent to + * unsetting the "metaid" attribute. */ LIBSBML_EXTERN int @@ -4906,6 +4914,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -4931,6 +4942,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/Species.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/Species.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/Species.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1788,6 +1788,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1814,6 +1817,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int @@ -1842,6 +1848,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "speciesType" attribute. */ LIBSBML_EXTERN int @@ -1869,6 +1878,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "compartment" attribute. */ LIBSBML_EXTERN int @@ -1950,6 +1962,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "substanceUnits" attribute. */ LIBSBML_EXTERN int @@ -1978,6 +1993,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "spatialSizeUnits" attribute. * * @warning In versions of SBML Level~2 before Version 3, the class * Species included an attribute called "spatialSizeUnits", which allowed @@ -2014,6 +2032,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "units" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/SpeciesReference.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/SpeciesReference.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/SpeciesReference.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1871,6 +1871,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1899,6 +1902,9 @@ * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> * LIBSBML_UNEXPECTED_ATTRIBUTE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int @@ -1926,6 +1932,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "species" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/SpeciesType.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/SpeciesType.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/SpeciesType.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -549,6 +549,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -573,6 +576,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/UnitDefinition.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/UnitDefinition.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/UnitDefinition.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -1539,6 +1539,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with an id of NULL is equivalent to + * unsetting the "id" attribute. */ LIBSBML_EXTERN int @@ -1562,6 +1565,9 @@ * * LIBSBML_OPERATION_SUCCESS<br> * LIBSBML_INVALID_ATTRIBUTE_VALUE<br> + * + * @note Using this function with the name set to NULL is equivalent to + * unsetting the "name" attribute. */ LIBSBML_EXTERN int Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestCompartmentType_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestCompartmentType_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestCompartmentType_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -75,6 +75,16 @@ END_TEST +START_TEST (test_CompartmentType_setId4) +{ + int i = CompartmentType_setId(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !CompartmentType_isSetId(C) ); +} +END_TEST + + START_TEST (test_CompartmentType_setName1) { int i = CompartmentType_setName(C, "cell"); @@ -105,6 +115,16 @@ END_TEST +START_TEST (test_CompartmentType_setName3) +{ + int i = CompartmentType_setName(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !CompartmentType_isSetName(C) ); +} +END_TEST + + Suite * create_suite_CompartmentType_newSetters (void) { @@ -118,8 +138,10 @@ tcase_add_test( tcase, test_CompartmentType_setId2 ); tcase_add_test( tcase, test_CompartmentType_setId3 ); + tcase_add_test( tcase, test_CompartmentType_setId4 ); tcase_add_test( tcase, test_CompartmentType_setName1 ); tcase_add_test( tcase, test_CompartmentType_setName2 ); + tcase_add_test( tcase, test_CompartmentType_setName3 ); suite_add_tcase(suite, tcase); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestCompartment_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestCompartment_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestCompartment_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -110,6 +110,21 @@ END_TEST +START_TEST (test_Compartment_setCompartmentType4) +{ + Compartment_t *c = + Compartment_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Compartment_setCompartmentType(c, NULL); + + fail_unless( i == 0 ); + fail_unless( !Compartment_isSetCompartmentType(c) ); + + Compartment_free(c); +} +END_TEST + + /* since the setId function has been used as an * alias for setName we cant require it to only * be used on a L2 model @@ -154,6 +169,21 @@ END_TEST +START_TEST (test_Compartment_setId4) +{ + Compartment_t *c = + Compartment_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Compartment_setId(c, NULL); + + fail_unless( i == 0 ); + fail_unless( !Compartment_isSetId(c) ); + + Compartment_free(c); +} +END_TEST + + START_TEST (test_Compartment_setName1) { int i = Compartment_setName(C, "cell"); @@ -189,6 +219,16 @@ END_TEST +START_TEST (test_Compartment_setName3) +{ + int i = Compartment_setName(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !Compartment_isSetName(C) ); +} +END_TEST + + START_TEST (test_Compartment_setSpatialDimensions1) { int i = Compartment_setSpatialDimensions(C, 2); @@ -334,6 +374,16 @@ END_TEST +START_TEST (test_Compartment_setUnits3) +{ + int i = Compartment_setUnits(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !Compartment_isSetUnits(C) ); +} +END_TEST + + START_TEST (test_Compartment_setOutside1) { int i = Compartment_setOutside(C, "1cell"); @@ -364,6 +414,16 @@ END_TEST +START_TEST (test_Compartment_setOutside3) +{ + int i = Compartment_setOutside(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !Compartment_isSetOutside(C) ); +} +END_TEST + + START_TEST (test_Compartment_setConstant1) { int i = Compartment_setConstant(C, 0); @@ -403,10 +463,13 @@ tcase_add_test( tcase, test_Compartment_setCompartmentType1 ); tcase_add_test( tcase, test_Compartment_setCompartmentType2 ); tcase_add_test( tcase, test_Compartment_setCompartmentType3 ); + tcase_add_test( tcase, test_Compartment_setCompartmentType4 ); tcase_add_test( tcase, test_Compartment_setId2 ); tcase_add_test( tcase, test_Compartment_setId3 ); + tcase_add_test( tcase, test_Compartment_setId4 ); tcase_add_test( tcase, test_Compartment_setName1 ); tcase_add_test( tcase, test_Compartment_setName2 ); + tcase_add_test( tcase, test_Compartment_setName3 ); tcase_add_test( tcase, test_Compartment_setSpatialDimensions1 ); tcase_add_test( tcase, test_Compartment_setSpatialDimensions2 ); tcase_add_test( tcase, test_Compartment_setSpatialDimensions3 ); @@ -416,8 +479,10 @@ tcase_add_test( tcase, test_Compartment_setVolume2 ); tcase_add_test( tcase, test_Compartment_setUnits1 ); tcase_add_test( tcase, test_Compartment_setUnits2 ); + tcase_add_test( tcase, test_Compartment_setUnits3 ); tcase_add_test( tcase, test_Compartment_setOutside1 ); tcase_add_test( tcase, test_Compartment_setOutside2 ); + tcase_add_test( tcase, test_Compartment_setOutside3 ); tcase_add_test( tcase, test_Compartment_setConstant1 ); tcase_add_test( tcase, test_Compartment_setConstant2 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestEvent_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestEvent_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestEvent_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -87,6 +87,16 @@ END_TEST +START_TEST (test_Event_setId3) +{ + int i = Event_setId(E, NULL); + + fail_unless( i == 0 ); + fail_unless( !Event_isSetId(E) ); +} +END_TEST + + START_TEST (test_Event_setName1) { char *name = "3Set_k2"; @@ -118,6 +128,16 @@ END_TEST +START_TEST (test_Event_setName3) +{ + int i = Event_setName(E, NULL); + + fail_unless( i == 0 ); + fail_unless( !Event_isSetName(E) ); +} +END_TEST + + START_TEST (test_Event_setTrigger1) { const Trigger_t *trigger @@ -238,6 +258,20 @@ END_TEST +START_TEST (test_Event_setTimeUnits4) +{ + Event_t *e = Event_createWithLevelVersionAndNamespaces(2, 1, 0); + + int i = Event_setTimeUnits(e, NULL); + + fail_unless( i == 0); + fail_unless( !Event_isSetTimeUnits(e) ); + + Event_free(e); +} +END_TEST + + START_TEST (test_Event_setUseValuesFromTriggerTime1) { Event_t *e = Event_createWithLevelVersionAndNamespaces(2, 4, 0); @@ -344,8 +378,10 @@ tcase_add_test( tcase, test_Event_setId1 ); tcase_add_test( tcase, test_Event_setId2 ); + tcase_add_test( tcase, test_Event_setId3 ); tcase_add_test( tcase, test_Event_setName1 ); tcase_add_test( tcase, test_Event_setName2 ); + tcase_add_test( tcase, test_Event_setName3 ); tcase_add_test( tcase, test_Event_setTrigger1 ); tcase_add_test( tcase, test_Event_setTrigger2 ); tcase_add_test( tcase, test_Event_setDelay1 ); @@ -353,6 +389,7 @@ tcase_add_test( tcase, test_Event_setTimeUnits1 ); tcase_add_test( tcase, test_Event_setTimeUnits2 ); tcase_add_test( tcase, test_Event_setTimeUnits3 ); + tcase_add_test( tcase, test_Event_setTimeUnits4 ); tcase_add_test( tcase, test_Event_setUseValuesFromTriggerTime1 ); tcase_add_test( tcase, test_Event_setUseValuesFromTriggerTime2 ); tcase_add_test( tcase, test_Event_addEventAssignment1 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestFunctionDefinition_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestFunctionDefinition_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestFunctionDefinition_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -115,6 +115,16 @@ END_TEST +START_TEST (test_FunctionDefinition_setName3) +{ + int i = FunctionDefinition_setName(E, NULL); + + fail_unless( i == 0 ); + fail_unless( !FunctionDefinition_isSetName(E) ); +} +END_TEST + + START_TEST (test_FunctionDefinition_setMath1) { ASTNode_t *math = SBML_parseFormula("2 * k"); @@ -165,6 +175,7 @@ tcase_add_test( tcase, test_FunctionDefinition_setId2 ); tcase_add_test( tcase, test_FunctionDefinition_setName1 ); tcase_add_test( tcase, test_FunctionDefinition_setName2 ); + tcase_add_test( tcase, test_FunctionDefinition_setName3 ); tcase_add_test( tcase, test_FunctionDefinition_setMath1 ); tcase_add_test( tcase, test_FunctionDefinition_setMath2 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestKineticLaw_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestKineticLaw_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestKineticLaw_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -204,6 +204,21 @@ END_TEST +START_TEST (test_KineticLaw_setTimeUnits4) +{ + KineticLaw_t *KL1 = + KineticLaw_createWithLevelVersionAndNamespaces(1, 2, 0); + + int i = KineticLaw_setTimeUnits(KL1, NULL); + + fail_unless( i == 0); + fail_unless( !KineticLaw_isSetTimeUnits(KL1) ); + + KineticLaw_free(KL1); +} +END_TEST + + START_TEST (test_KineticLaw_setSubstanceUnits1) { int i = KineticLaw_setSubstanceUnits(KL, "mole"); @@ -259,6 +274,21 @@ END_TEST +START_TEST (test_KineticLaw_setSubstanceUnits4) +{ + KineticLaw_t *KL1 = + KineticLaw_createWithLevelVersionAndNamespaces(1, 2, 0); + + int i = KineticLaw_setSubstanceUnits(KL1, NULL); + + fail_unless( i == 0); + fail_unless( !KineticLaw_isSetSubstanceUnits(KL1) ); + + KineticLaw_free(KL1); +} +END_TEST + + START_TEST (test_KineticLaw_addParameter1) { KineticLaw_t *kl = KineticLaw_createWithLevelVersionAndNamespaces(2, 2, 0); @@ -360,9 +390,11 @@ tcase_add_test( tcase, test_KineticLaw_setTimeUnits1 ); tcase_add_test( tcase, test_KineticLaw_setTimeUnits2 ); tcase_add_test( tcase, test_KineticLaw_setTimeUnits3 ); + tcase_add_test( tcase, test_KineticLaw_setTimeUnits4 ); tcase_add_test( tcase, test_KineticLaw_setSubstanceUnits1 ); tcase_add_test( tcase, test_KineticLaw_setSubstanceUnits2 ); tcase_add_test( tcase, test_KineticLaw_setSubstanceUnits3 ); + tcase_add_test( tcase, test_KineticLaw_setSubstanceUnits4 ); tcase_add_test( tcase, test_KineticLaw_addParameter1 ); tcase_add_test( tcase, test_KineticLaw_addParameter2 ); tcase_add_test( tcase, test_KineticLaw_addParameter3 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestModel_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestModel_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestModel_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -136,6 +136,16 @@ END_TEST +START_TEST (test_Model_setName3) +{ + int i = Model_setName(M, NULL); + + fail_unless( i == 0 ); + fail_unless( !Model_isSetName(M) ); +} +END_TEST + + START_TEST (test_Model_setModelHistory1) { ModelHistory_t *mh = ModelHistory_create(); @@ -1169,6 +1179,7 @@ tcase_add_test( tcase, test_Model_setId3 ); tcase_add_test( tcase, test_Model_setName1 ); tcase_add_test( tcase, test_Model_setName2 ); + tcase_add_test( tcase, test_Model_setName3 ); tcase_add_test( tcase, test_Model_setModelHistory1 ); tcase_add_test( tcase, test_Model_setModelHistory2 ); tcase_add_test( tcase, test_Model_addFunctionDefinition1 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestParameter_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestParameter_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestParameter_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -115,6 +115,21 @@ END_TEST +START_TEST (test_Parameter_setName3) +{ + Parameter_t *p = + Parameter_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Parameter_setName(p, NULL); + + fail_unless( i == 0 ); + fail_unless( !Parameter_isSetName(p) ); + + Parameter_free(p); +} +END_TEST + + START_TEST (test_Parameter_setValue1) { int i = Parameter_setValue(P, 2.0); @@ -176,6 +191,16 @@ END_TEST +START_TEST (test_Parameter_setUnits3) +{ + int i = Parameter_setUnits(P, NULL); + + fail_unless( i == 0 ); + fail_unless( !Parameter_isSetUnits(P) ); +} +END_TEST + + START_TEST (test_Parameter_setConstant1) { int i = Parameter_setConstant(P, 0); @@ -216,10 +241,12 @@ tcase_add_test( tcase, test_Parameter_setId2 ); tcase_add_test( tcase, test_Parameter_setName1 ); tcase_add_test( tcase, test_Parameter_setName2 ); + tcase_add_test( tcase, test_Parameter_setName3 ); tcase_add_test( tcase, test_Parameter_setValue1 ); tcase_add_test( tcase, test_Parameter_setValue2 ); tcase_add_test( tcase, test_Parameter_setUnits1 ); tcase_add_test( tcase, test_Parameter_setUnits2 ); + tcase_add_test( tcase, test_Parameter_setUnits3 ); tcase_add_test( tcase, test_Parameter_setConstant1 ); tcase_add_test( tcase, test_Parameter_setConstant2 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestReaction_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestReaction_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestReaction_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -116,6 +116,21 @@ END_TEST +START_TEST (test_Reaction_setName3) +{ + Reaction_t *p = + Reaction_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Reaction_setName(p, NULL); + + fail_unless( i == 0 ); + fail_unless( !Reaction_isSetName(p) ); + + Reaction_free(p); +} +END_TEST + + START_TEST (test_Reaction_setFast1) { int i = Reaction_setFast(R, 1); @@ -484,6 +499,7 @@ tcase_add_test( tcase, test_Reaction_setId2 ); tcase_add_test( tcase, test_Reaction_setName1 ); tcase_add_test( tcase, test_Reaction_setName2 ); + tcase_add_test( tcase, test_Reaction_setName3 ); tcase_add_test( tcase, test_Reaction_setReversible1 ); tcase_add_test( tcase, test_Reaction_setFast1 ); tcase_add_test( tcase, test_Reaction_setFast2 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestRule_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestRule_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestRule_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -201,6 +201,27 @@ END_TEST +START_TEST (test_Rule_setUnits4) +{ + Rule_t *R1 = + Rule_createAssignmentWithLevelVersionAndNamespaces(1, 2, 0); + Rule_setL1TypeCode(R1, SBML_PARAMETER_RULE); + + int i = Rule_setUnits(R1, "second"); + + fail_unless( i == 0); + fail_unless( Rule_isSetUnits(R1) ); + + i = Rule_setUnits(R1, NULL); + + fail_unless( i == 0); + fail_unless( !Rule_isSetUnits(R1) ); + + Rule_free(R1); +} +END_TEST + + START_TEST (test_Rule_setVariable1) { int i = Rule_setVariable(R, "1mole"); @@ -261,6 +282,7 @@ tcase_add_test( tcase, test_Rule_setUnits1 ); tcase_add_test( tcase, test_Rule_setUnits2 ); tcase_add_test( tcase, test_Rule_setUnits3 ); + tcase_add_test( tcase, test_Rule_setUnits4 ); tcase_add_test( tcase, test_Rule_setVariable1 ); tcase_add_test( tcase, test_Rule_setVariable2 ); tcase_add_test( tcase, test_Rule_setVariable3 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestSBase_newSetters.cpp =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestSBase_newSetters.cpp 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestSBase_newSetters.cpp 2008-12-02 19:27:53 UTC (rev 8480) @@ -479,6 +479,22 @@ END_TEST +START_TEST (test_SBase_setMetaId4) +{ + int i = SBase_setMetaId(S, "cell"); + + fail_unless( i == 0 ); + fail_unless( SBase_isSetMetaId(S) ); + fail_unless( !strcmp(SBase_getMetaId(S), "cell" )); + + i = SBase_setMetaId(S, NULL); + + fail_unless( i == 0 ); + fail_unless( !SBase_isSetMetaId(S) ); +} +END_TEST + + START_TEST (test_SBase_setSBOTerm1) { SBase *C = new(std::nothrow) Compartment(1, 2); @@ -533,6 +549,7 @@ tcase_add_test(tcase, test_SBase_setMetaId1 ); tcase_add_test(tcase, test_SBase_setMetaId2 ); tcase_add_test(tcase, test_SBase_setMetaId3 ); + tcase_add_test(tcase, test_SBase_setMetaId4 ); tcase_add_test(tcase, test_SBase_setSBOTerm1 ); tcase_add_test(tcase, test_SBase_setSBOTerm2 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesReference_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesReference_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesReference_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -99,6 +99,22 @@ END_TEST +START_TEST (test_SpeciesReference_setId4) +{ + int i = SpeciesReference_setId(SR, "cell"); + + fail_unless( i == 0 ); + fail_unless( SpeciesReference_isSetId(SR) ); + fail_unless( !strcmp(SpeciesReference_getId(SR), "cell" )); + + i = SpeciesReference_setId(SR, NULL); + + fail_unless( i == 0 ); + fail_unless( !SpeciesReference_isSetId(SR) ); +} +END_TEST + + START_TEST (test_SpeciesReference_setName1) { int i = SpeciesReference_setName(SR, "cell"); @@ -144,6 +160,21 @@ END_TEST +START_TEST (test_SpeciesReference_setName4) +{ + int i = SpeciesReference_setName(SR, "cell"); + + fail_unless( i == 0 ); + fail_unless( SpeciesReference_isSetName(SR) ); + + i = SpeciesReference_setName(SR, NULL); + + fail_unless( i == 0 ); + fail_unless( !SpeciesReference_isSetName(SR) ); +} +END_TEST + + START_TEST (test_SpeciesReference_setSpecies1) { int i = SpeciesReference_setSpecies(SR, "mm"); @@ -186,6 +217,21 @@ END_TEST +START_TEST (test_SpeciesReference_setSpecies4) +{ + int i = SpeciesReference_setSpecies(SR, "mm"); + + fail_unless( i == 0 ); + fail_unless( SpeciesReference_isSetSpecies(SR) ); + + i = SpeciesReference_setSpecies(SR, NULL); + + fail_unless( i == 0 ); + fail_unless( !SpeciesReference_isSetSpecies(SR) ); +} +END_TEST + + START_TEST (test_SpeciesReference_setStoichiometry1) { int i = SpeciesReference_setStoichiometry(SR, 2.0); @@ -379,12 +425,15 @@ tcase_add_test( tcase, test_SpeciesReference_setId1 ); tcase_add_test( tcase, test_SpeciesReference_setId2 ); tcase_add_test( tcase, test_SpeciesReference_setId3 ); + tcase_add_test( tcase, test_SpeciesReference_setId4 ); tcase_add_test( tcase, test_SpeciesReference_setName1 ); tcase_add_test( tcase, test_SpeciesReference_setName2 ); tcase_add_test( tcase, test_SpeciesReference_setName3 ); + tcase_add_test( tcase, test_SpeciesReference_setName4 ); tcase_add_test( tcase, test_SpeciesReference_setSpecies1 ); tcase_add_test( tcase, test_SpeciesReference_setSpecies2 ); tcase_add_test( tcase, test_SpeciesReference_setSpecies3 ); + tcase_add_test( tcase, test_SpeciesReference_setSpecies4 ); tcase_add_test( tcase, test_SpeciesReference_setStoichiometry1 ); tcase_add_test( tcase, test_SpeciesReference_setStoichiometry2 ); tcase_add_test( tcase, test_SpeciesReference_setDenominator1 ); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesType_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesType_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestSpeciesType_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -75,6 +75,22 @@ END_TEST +START_TEST (test_SpeciesType_setId4) +{ + int i = SpeciesType_setId(ST, "cell"); + + fail_unless( i == 0 ); + fail_unless( SpeciesType_isSetId(ST) ); + fail_unless( !strcmp(SpeciesType_getId(ST), "cell" )); + + i = SpeciesType_setId(ST, NULL); + + fail_unless( i == 0 ); + fail_unless( !SpeciesType_isSetId(ST) ); +} +END_TEST + + START_TEST (test_SpeciesType_setName1) { int i = SpeciesType_setName(ST, "cell"); @@ -105,6 +121,21 @@ END_TEST +START_TEST (test_SpeciesType_setName3) +{ + int i = SpeciesType_setName(ST, "cell"); + + fail_unless( i == 0 ); + fail_unless( SpeciesType_isSetName(ST) ); + + i = SpeciesType_setName(ST, NULL); + + fail_unless( i == 0 ); + fail_unless( !SpeciesType_isSetName(ST) ); +} +END_TEST + + Suite * create_suite_SpeciesType_newSetters (void) { @@ -118,8 +149,10 @@ tcase_add_test( tcase, test_SpeciesType_setId2 ); tcase_add_test( tcase, test_SpeciesType_setId3 ); + tcase_add_test( tcase, test_SpeciesType_setId4 ); tcase_add_test( tcase, test_SpeciesType_setName1 ); tcase_add_test( tcase, test_SpeciesType_setName2 ); + tcase_add_test( tcase, test_SpeciesType_setName3 ); suite_add_tcase(suite, tcase); Modified: branches/libsbml-new-api-3.3/src/sbml/test/TestSpecies_newSetters.c =================================================================== --- branches/libsbml-new-api-3.3/src/sbml/test/TestSpecies_newSetters.c 2008-12-02 10:30:42 UTC (rev 8479) +++ branches/libsbml-new-api-3.3/src/sbml/test/TestSpecies_newSetters.c 2008-12-02 19:27:53 UTC (rev 8480) @@ -110,6 +110,27 @@ END_TEST +START_TEST (test_Species_setSpeciesType4) +{ + Species_t *c = + Species_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Species_setSpeciesType(c, "cell"); + + fail_unless( i == 0 ); + fail_unless( Species_isSetSpeciesType(c) ); + fail_unless( !strcmp(Species_getSpeciesType(c), "cell" )); + + i = Species_setSpeciesType(c, NULL); + + fail_unless( i == 0 ); + fail_unless( !Species_isSetSpeciesType(c) ); + + Species_free(c); +} +END_TEST + + /* since the setId function has been used as an * alias for setName we cant require it to only * be used on a L2 model @@ -154,6 +175,27 @@ END_TEST +START_TEST (test_Species_setId4) +{ + Species_t *c = + Species_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Species_setId(c, "cell"); + + fail_unless( i == 0 ); + fail_unless( Species_isSetId(c) ); + fail_unless( !strcmp(Species_getId(c), "cell" )); + + i = Species_setId(c, NULL); + + fail_unless( i == 0 ); + fail_unless( !Species_isSetId(c) ); + + Species_free(c); +} +END_TEST + + START_TEST (test_Species_setName1) { int i = Species_setName(C, "cell"); @@ -189,6 +231,21 @@ END_TEST +START_TEST (test_Species_setName3) +{ + int i = Species_setName(C, "cell"); + + fail_unless( i == 0 ); + fail_unless( Species_isSetName(C) ); + + i = Species_setName(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !Species_isSetName(C) ); +} +END_TEST + + START_TEST (test_Species_setSubstanceUnits1) { int i = Species_setSubstanceUnits(C, "mm"); @@ -231,6 +288,27 @@ END_TEST +START_TEST (test_Species_setSubstanceUnits4) +{ + Species_t *c = + Species_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Species_setSubstanceUnits(c, "mole"); + + fail_unless( i == 0 ); + fail_unless( !strcmp(Species_getSubstanceUnits(c), "mole") ); + fail_unless( Species_isSetSubstanceUnits(c) ); + + i = Species_setSubstanceUnits(c, NULL); + + fail_unless( i == 0 ); + fail_unless( !Species_isSetSubstanceUnits(c) ); + + Species_free(c); +} +END_TEST + + START_TEST (test_Species_setInitialConcentration1) { int i = Species_setInitialConcentration(C, 2.0); @@ -330,6 +408,21 @@ END_TEST +START_TEST (test_Species_setUnits3) +{ + int i = Species_setUnits(C, "litre"); + + fail_unless( i == 0 ); + fail_unless( Species_isSetUnits(C) ); + + i = Species_setUnits(C, NULL); + + fail_unless( i == 0 ); + fail_unless( !Species_isSetUnits(C) ); +} +END_TEST + + START_TEST (test_Species_setCompartment1) { int i = Species_setCompartment(C, "1cell"); @@ -427,6 +520,21 @@ END_TEST +START_TEST (test_Species_setSpatialSizeUnits4) +{ + Species_t *c = + Species_createWithLevelVersionAndNamespaces(2, 2, 0); + + int i = Species_setSpatialSizeUnits(c, NULL); + + fail_unless( i == 0 ); + fail_unless( !Species_isSetSpatialSizeUnits(c) ); + + Species_free(c); +} +END_TEST + + START_TEST (test_Species_setHasOnlySubstanceUnits1) { int i = Species_setHasOnlySubstanceUnits(C, 0); @@ -534,17 +642,21 @@ tcase_add_test( tcase, test_Species_setSpeciesType3 ); tcase_add_test( tcase, test_Species_setId2 ); tcase_add_test( tcase, test_Species_setId3 ); + tcase_add_test( tcase, test_Species_setId4 ); tcase_add_test( tcase, test_Species_setName1 ); tcase_add_test( tcase, test_Species_setName2 ); + tcase_add_test( tcase, test_Species_setName3 ); tcase_add_test( tcase, test_Species_setSubstanceUnits1 ); tcase_add_test( tcase, test_Species_setSubstanceUnits2 ); tcase_add_test( tcase, test_Species_setSubstanceUnits3 ); + tcase_add_test( tcase, test_Species_setSubstanceUnits4 ); tcase_add_test( tcase, test_Species_setInitialConcentration1 ); tcase_add_test( tcase, test_Species_setInitialConcentration2 ); tcase_add_test( tcase, test_Species_setInitialAmount1 ); tcase_add_test( tcase, test_Species_setInitialAmount2 ); tcase_add_test( tcase, test_Species_setUnits1 ); tcase_add_test( tcase, test_Species_setUnits2 ); + tcase_add_test( tcase, test_Species_setUnits3 ); tcase_add_test( tcase, test_Species_setCompartment1 ); tcase_add_test( tcase, test_Species_setCompartment2 ); tcase_add_test( tcase, test_Species_setConstant1 ); @@ -552,6 +664,7 @@ tcase_add_test( tcase, test_Species_setSpatialSizeUnits1 ); tcase_add_test( tcase, test_Species_setSpatialSizeUnits2 ); tcase_add_test( tcase, test_Species_setSpatialSizeUnits3 ); + tcase_add_test( tcase, test_Species_setSpatialSizeUnits4 ); tcase_add_test( tcase, test_Species_setHasOnlySubstanceUnits1 ); tcase_add_test( tcase, test_Species_setHasOnlySubstanceUnits2 ); tcase_add_test( tcase, test_Species_setBoundaryCondition1 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |