END_TEST START_TEST (test_ParameterRule_setUnits) { const char *units = "cell"; Rule_setUnits(PR, units); fail_unless( !strcmp(Rule_getUnits(PR), units) ); fail_unless( Rule_isSetUnits(PR) ); if (Rule_getUnits(PR) == units) { fail( "Rule_setUnits(...) did not make a copy of string." ); } /* Reflexive case (pathological) */ Rule_setUnits(PR, Rule_getUnits(PR)); fail_unless( !strcmp(Rule_getUnits(PR), units) ); Rule_setUnits(PR, NULL); fail_unless( !Rule_isSetUnits(PR) ); if (Rule_getUnits(PR) != NULL) { fail( "Rule_setUnits(PR, NULL) did not clear string." ); } }
END_TEST START_TEST (test_Rule_setUnits1) { int i = Rule_setUnits(R, "second"); fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE); fail_unless( !Rule_isSetUnits(R) ); }
END_TEST START_TEST (test_Rule_setUnits4) { Rule_t *R1 = Rule_createAssignment(1, 2); Rule_setL1TypeCode(R1, SBML_PARAMETER_RULE); int i = Rule_setUnits(R1, "second"); fail_unless( i == LIBSBML_OPERATION_SUCCESS); fail_unless( Rule_isSetUnits(R1) ); i = Rule_setUnits(R1, NULL); fail_unless( i == LIBSBML_OPERATION_SUCCESS); fail_unless( !Rule_isSetUnits(R1) ); Rule_free(R1); }
END_TEST START_TEST (test_Rule_setUnits3) { Rule_t *R1 = Rule_createAssignment(1, 2); Rule_setL1TypeCode(R1, SBML_PARAMETER_RULE); int i = Rule_setUnits(R1, "1second"); fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE); fail_unless( !Rule_isSetUnits(R1) ); i = Rule_unsetUnits(R1); fail_unless( i == LIBSBML_OPERATION_SUCCESS); fail_unless( !Rule_isSetUnits(R1) ); Rule_free(R1); }