END_TEST START_TEST (test_comp_deletion_free_NULL) { Deletion_free(NULL); }
END_TEST START_TEST (test_comp_submodel_deletion) { Deletion_t *deletion = Deletion_create(3, 1, 1); const char* delname = "deletion"; SBaseRef_setIdRef((SBaseRef_t*)deletion, "ref_id"); fail_unless( Submodel_getNumDeletions(P) == 0 ); Submodel_addDeletion(P, deletion); Deletion_t* getdel = Submodel_getDeletion(P, 0); fail_unless( getdel != NULL); fail_unless( Submodel_getNumDeletions(P)==1 ); if (getdel == deletion) { fail("Submodel_addDeletion(...) did not make a copy of the deletion."); } Deletion_free(getdel); Submodel_removeDeletion(P, 0); fail_unless( Submodel_getDeletion(P, 0) == NULL); fail_unless( Submodel_getNumDeletions(P)==0 ); Deletion_setId(deletion, delname); Submodel_addDeletion(P, deletion); fail_unless( Submodel_getDeletionById(P, delname) != NULL); Deletion_t* remdel = Submodel_removeDeletionById(P, delname); Deletion_free(remdel); fail_unless( Submodel_getDeletionById(P, delname) == NULL); fail_unless( Submodel_getNumDeletions(P)==0 ); Deletion_free(deletion); }
END_TEST START_TEST (test_comp_deletion_hasRequiredAttributes ) { Deletion_t *P = Deletion_create (3, 1, 1); fail_unless ( !Deletion_hasRequiredAttributes(P)); Deletion_setId(P, "p"); fail_unless ( !Deletion_hasRequiredAttributes(P)); SBaseRef_setIdRef((SBaseRef_t*)(P), "s"); fail_unless ( Deletion_hasRequiredAttributes(P)); Deletion_free(P); }
void DeletionTest_teardown (void) { Deletion_free(P); }