X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Ftest.h;h=77aa5303bbe2bd580e7c1c1d8670463c8e565d00;hb=4effcb18b27e2d84a8b29bc311b5edbee3c004b6;hp=28388bbd7f0add79e79863005a50c5b11b36cf48;hpb=a4456cc10079f2e6f648befc91657f2723c825e5;p=awesomized%2Flibmemcached diff --git a/tests/test.h b/tests/test.h index 28388bbd..77aa5303 100644 --- a/tests/test.h +++ b/tests/test.h @@ -39,6 +39,8 @@ typedef test_return_t (*test_callback_fn)(void *); typedef test_return_t (*test_callback_runner_fn)(test_callback_fn, void *); typedef test_return_t (*test_callback_error_fn)(test_return_t, void *); +/* Help function for use with gettimeofday() */ +long int timedif(struct timeval a, struct timeval b); /** A structure describing the test case. @@ -150,9 +152,11 @@ const char *test_strerror(test_return_t code); #define test_fail(A) \ do \ { \ - fprintf(stderr, "\nFailed in %s:%d: %s\n", __FILE__, __LINE__, #A);\ - create_core(); \ - return TEST_FAILURE; \ + if (1) { \ + fprintf(stderr, "\nFailed in %s:%d: %s\n", __FILE__, __LINE__, #A);\ + create_core(); \ + return TEST_FAILURE; \ + } \ } while (0) #define test_true(A) \