示例#1
0
END_TEST


START_TEST (test_FunctionDefinition_setName)
{
  const char *name = "Cube_Me";


  FunctionDefinition_setName(FD, name);

  fail_unless( !strcmp(FunctionDefinition_getName(FD), name) );
  fail_unless( FunctionDefinition_isSetName(FD) );

  if (FunctionDefinition_getName(FD) == name)
  {
    fail("FunctionDefinition_setName(...) did not make a copy of string.");
  }

  /* Reflexive case (pathological) */
  FunctionDefinition_setName(FD, FunctionDefinition_getName(FD));
  fail_unless( !strcmp(FunctionDefinition_getName(FD), name) );

  FunctionDefinition_setName(FD, NULL);
  fail_unless( !FunctionDefinition_isSetName(FD) );

  if (FunctionDefinition_getName(FD) != NULL)
  {
    fail("FunctionDefinition_setName(FD, NULL) did not clear string.");
  }
}
END_TEST


START_TEST (test_FunctionDefinition_setName3)
{
  int i = FunctionDefinition_setName(E, NULL);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( !FunctionDefinition_isSetName(E) );
}
END_TEST


START_TEST (test_FunctionDefinition_setName1)
{
  char *name = "3Set_k2";

  int i = FunctionDefinition_setName(E, name);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( FunctionDefinition_isSetName(E) );
}
END_TEST


START_TEST (test_FunctionDefinition_setName2)
{
  char *name = "Set k2";

  int i = FunctionDefinition_setName(E, name);

  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( !strcmp(FunctionDefinition_getName(E), name) );
  fail_unless( FunctionDefinition_isSetName(E) );

  i = FunctionDefinition_unsetName(E);


  fail_unless( i == LIBSBML_OPERATION_SUCCESS );
  fail_unless( !FunctionDefinition_isSetName(E) );
}