END_TEST START_TEST (test_ModelHistory_addCreator) { ModelCreator_t * newMC; ModelHistory_t * history = ModelHistory_create(); fail_unless(ModelHistory_getNumCreators(history) == 0); fail_unless(history != NULL); ModelCreator_t * mc = ModelCreator_create(); fail_unless(mc != NULL); ModelCreator_setFamilyName(mc, "Keating"); ModelCreator_setGivenName(mc, "Sarah"); ModelCreator_setEmail(mc, "*****@*****.**"); ModelCreator_setOrganisation(mc, "UH"); ModelHistory_addCreator(history, mc); fail_unless(ModelHistory_getNumCreators(history) == 1); ModelCreator_free(mc); newMC = (ModelCreator_t*) List_get(ModelHistory_getListCreators(history), 0); fail_unless(newMC != NULL); fail_unless(!strcmp(ModelCreator_getFamilyName(newMC), "Keating")); fail_unless(!strcmp(ModelCreator_getGivenName(newMC), "Sarah")); fail_unless(!strcmp(ModelCreator_getEmail(newMC), "*****@*****.**")); fail_unless(!strcmp(ModelCreator_getOrganisation(newMC), "UH")); ModelHistory_free(history); }
END_TEST START_TEST (test_ModelHistory_accessWithNULL) { fail_unless ( ModelHistory_addCreator(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless ( ModelHistory_addModifiedDate(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless ( ModelHistory_clone(NULL) == NULL ); // ensure that we don't crash ModelHistory_free(NULL) ; fail_unless ( ModelHistory_getCreatedDate(NULL) == NULL ); fail_unless ( ModelHistory_getCreator(NULL, 0) == NULL ); fail_unless ( ModelHistory_getListCreators(NULL) == NULL ); fail_unless ( ModelHistory_getListModifiedDates(NULL) == NULL ); fail_unless ( ModelHistory_getModifiedDate(NULL) == NULL ); fail_unless ( ModelHistory_getModifiedDateFromList(NULL, 0) == NULL ); fail_unless ( ModelHistory_getNumCreators(NULL) == SBML_INT_MAX ); fail_unless ( ModelHistory_getNumModifiedDates(NULL) == SBML_INT_MAX ); fail_unless ( ModelHistory_hasRequiredAttributes(NULL) == 0 ); fail_unless ( ModelHistory_isSetCreatedDate(NULL) == 0 ); fail_unless ( ModelHistory_isSetModifiedDate(NULL) == 0 ); fail_unless ( ModelHistory_setCreatedDate(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless ( ModelHistory_setModifiedDate(NULL, NULL) == LIBSBML_INVALID_OBJECT ); }
END_TEST START_TEST (test_ModelHistory_addCreator3) { ModelHistory_t * mh = ModelHistory_create(); ModelCreator_t * mc = NULL; int i = ModelHistory_addCreator(mh, mc); fail_unless( i == LIBSBML_OPERATION_FAILED ); fail_unless(ModelHistory_getNumCreators(mh) == 0); ModelHistory_free(mh); }
END_TEST START_TEST (test_ModelHistory_addCreator2) { ModelHistory_t * mh = ModelHistory_create(); ModelCreator_t * mc = ModelCreator_create(); ModelCreator_setGivenName(mc, "Sarah"); int i = ModelHistory_addCreator(mh, mc); fail_unless( i == LIBSBML_INVALID_OBJECT ); fail_unless(ModelHistory_getNumCreators(mh) == 0); ModelCreator_free(mc); ModelHistory_free(mh); }
END_TEST START_TEST (test_ModelHistory_addCreator1) { ModelHistory_t * mh = ModelHistory_create(); ModelCreator_t * mc = ModelCreator_create(); ModelCreator_setFamilyName(mc, "Keating"); ModelCreator_setGivenName(mc, "Sarah"); int i = ModelHistory_addCreator(mh, mc); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless(ModelHistory_getNumCreators(mh) == 1); ModelCreator_free(mc); ModelHistory_free(mh); }