END_TEST START_TEST (test_ModelCreator_setOrganization) { ModelCreator_t * mc = ModelCreator_create(); fail_unless(mc != NULL); int i = ModelCreator_setOrganization(mc, "Caltech"); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless(ModelCreator_isSetOrganization(mc) == 1); fail_unless(!strcmp(ModelCreator_getOrganization(mc), "Caltech")); i = ModelCreator_setOrganization(mc, ""); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless(ModelCreator_isSetOrganization(mc) == 0); i = ModelCreator_setOrganization(mc, "Caltech"); fail_unless(ModelCreator_isSetOrganization(mc) == 1); i = ModelCreator_unsetOrganization(mc); fail_unless( i == LIBSBML_OPERATION_SUCCESS ); fail_unless(ModelCreator_isSetOrganization(mc) == 0); ModelCreator_free(mc); }
END_TEST START_TEST (test_ModelCreator_accessWithNULL) { fail_unless( ModelCreator_clone(NULL) == NULL ); fail_unless( ModelCreator_createFromNode(NULL) == NULL ); ModelCreator_free(NULL); fail_unless( ModelCreator_getEmail(NULL) == NULL ); fail_unless( ModelCreator_getFamilyName(NULL) == NULL ); fail_unless( ModelCreator_getGivenName(NULL) == NULL ); fail_unless( ModelCreator_getOrganisation(NULL) == NULL ); fail_unless( ModelCreator_getOrganization(NULL) == NULL ); fail_unless( ModelCreator_hasRequiredAttributes(NULL) == 0 ); fail_unless( ModelCreator_isSetEmail(NULL) == 0 ); fail_unless( ModelCreator_isSetFamilyName(NULL) == 0 ); fail_unless( ModelCreator_isSetGivenName(NULL) == 0 ); fail_unless( ModelCreator_isSetOrganisation(NULL) == 0 ); fail_unless( ModelCreator_isSetOrganization(NULL) == 0 ); fail_unless( ModelCreator_setEmail(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_setFamilyName(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_setGivenName(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_setOrganisation(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_setOrganization(NULL, NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_unsetEmail(NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_unsetFamilyName(NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_unsetGivenName(NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_unsetOrganisation(NULL) == LIBSBML_INVALID_OBJECT ); fail_unless( ModelCreator_unsetOrganization(NULL) == LIBSBML_INVALID_OBJECT ); }
END_TEST START_TEST(test_ModelCreator_setters) { ModelCreator_t * mc = ModelCreator_create(); fail_unless(mc != NULL); fail_unless(ModelCreator_isSetFamilyName(mc) == 0); fail_unless(ModelCreator_isSetGivenName(mc) == 0); fail_unless(ModelCreator_isSetEmail(mc) == 0); fail_unless(ModelCreator_isSetOrganisation(mc) == 0); ModelCreator_setFamilyName(mc, "Keating"); ModelCreator_setGivenName(mc, "Sarah"); ModelCreator_setEmail(mc, "*****@*****.**"); ModelCreator_setOrganisation(mc, "UH"); fail_unless(!strcmp(ModelCreator_getFamilyName(mc), "Keating")); fail_unless(!strcmp(ModelCreator_getGivenName(mc), "Sarah")); fail_unless(!strcmp(ModelCreator_getEmail(mc), "*****@*****.**")); fail_unless(!strcmp(ModelCreator_getOrganisation(mc), "UH")); fail_unless(ModelCreator_isSetFamilyName(mc) == 1); fail_unless(ModelCreator_isSetGivenName(mc) == 1); fail_unless(ModelCreator_isSetEmail(mc) == 1); fail_unless(ModelCreator_isSetOrganisation(mc) == 1); ModelCreator_unsetFamilyName(mc); ModelCreator_unsetGivenName(mc); ModelCreator_unsetEmail(mc); ModelCreator_unsetOrganisation(mc); fail_unless(!strcmp(ModelCreator_getFamilyName(mc), "")); fail_unless(!strcmp(ModelCreator_getGivenName(mc), "")); fail_unless(!strcmp(ModelCreator_getEmail(mc), "")); fail_unless(!strcmp(ModelCreator_getOrganisation(mc), "")); fail_unless(ModelCreator_isSetFamilyName(mc) == 0); fail_unless(ModelCreator_isSetGivenName(mc) == 0); fail_unless(ModelCreator_isSetEmail(mc) == 0); fail_unless(ModelCreator_isSetOrganisation(mc) == 0); // test alternate spelling functions fail_unless(ModelCreator_isSetOrganization(mc) == 0); ModelCreator_setOrganization(mc, "UH"); fail_unless(!strcmp(ModelCreator_getOrganization(mc), "UH")); fail_unless(ModelCreator_isSetOrganization(mc) == 1); ModelCreator_unsetOrganisation(mc); fail_unless(!strcmp(ModelCreator_getOrganization(mc), "")); fail_unless(ModelCreator_isSetOrganization(mc) == 0); ModelCreator_free(mc); }