Ejemplo n.º 1
0
void test_double_function_registry()
{
  function_registry* fr = double_function_registry();
  double tester = 1.11;

  /* start the tests */
  printf("Test double_function_registry: ");
  CU_ASSERT_TRUE(!strcmp(fr->name, "float"));

  /* test the copy function */
  double* cpy = (double*)fr->copy(&tester);
  CU_ASSERT_EQUAL(*cpy, tester);

  /* test to be sure that it is actually a copy */
  tester = 2.11;
  CU_ASSERT_NOT_EQUAL(*cpy, tester);

  /* free memory */
  fr->destroy(cpy);
  test_failure();
  free(fr);

  /* finish the test */
  printf("\n");
}
Ejemplo n.º 2
0
void test_double_function_registry()
{
  function_registry* fr = double_function_registry();
  double tester = 1.11;

  /* start the tests */
  FO_ASSERT_TRUE(!strcmp(fr->name, "float"));

  /* test the copy function */
  double* cpy = (double*)fr->copy(&tester);
  FO_ASSERT_DOUBLE_EQUAL(*cpy, tester, 0.0001);

  /* test to be sure that it is actually a copy */
  tester = 2.11;
  FO_ASSERT_DOUBLE_NOT_EQUAL(*cpy, tester, 0.0001);

  /* free memory */
  fr->destroy(cpy);
  free(fr);

  /* finish the test */
}