Пример #1
0
END_TEST


START_TEST (test_comp_deletion_id)
{
  const char *id = "mitochondria";


  fail_unless( !Deletion_isSetId(P) );
  
  Deletion_setId(P, id);

  char* getid = Deletion_getId(P);
  fail_unless( !strcmp(getid, id) );
  fail_unless( Deletion_isSetId(P) );

  if (getid == id)
  {
    fail("Deletion_setId(...) did not make a copy of string.");
  }
 
  free(getid);
  Deletion_unsetId(P);
  
  fail_unless( !Deletion_isSetId(P) );

  if (Deletion_getId(P) != NULL)
  {
    fail("Deletion_unsetId(P) did not clear string.");
  }
}
Пример #2
0
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);
}
Пример #3
0
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);
}