50 #define ASSERT_TRUE(x) { \ 53 printf("\x1b[31mASSERT_TRUE( %d ) failed:\x1b[0m\n %s, line %d.\n", \ 54 x, __FILE__, __LINE__); \ 60 #define ASSERT_FALSE(x) { \ 63 printf("\x1b[31mASSERT_FALSE( %d ) failed:\x1b[0m\n %s, line %d.\n", \ 64 x, __FILE__, __LINE__); \ 70 #define EXPECT_TRUE(x) { \ 73 printf("\x1b[33mEXPECT_TRUE( %d ) failed:\x1b[0m\n %s, line %d.\n", \ 74 x, __FILE__, __LINE__); \ 79 #define EXPECT_FALSE(x) { \ 82 printf("\x1b[33mEXPECT_FALSE( %d ) failed:\x1b[0m\n %s, line %d.\n", \ 83 x, __FILE__, __LINE__); \ 88 #define ASSERT_EQ(x, y, tol) { \ 89 double err = fabs(1.0-(x)/(y)); \ 92 printf("\x1b[31mASSERT_EQ( %.3e , %.3e , %.3e ) failed ( err = %.3e ):\x1b[0m\n %s, line %d.\n", \ 93 x, y, tol, err, __FILE__, __LINE__); \ 99 #define EXPECT_EQ(x, y, tol) { \ 100 double err = fabs(1.0-(x)/(y)); \ 103 printf("\x1b[33mEXPECT_EQ( %.3e , %.3e , %.3e ) failed ( err = %.3e ):\x1b[0m\n %s, line %d.\n", \ 104 x, y, tol, err, __FILE__, __LINE__); \ 110 #define ASSERT_LT(x, y) { \ 113 printf("\x1b[31mASSERT_LT( %.3e , %.3e ) failed:\x1b[0m\n %s, line %d.\n", \ 114 x, y, __FILE__, __LINE__); \ 120 #define EXPECT_LT(x, y) { \ 123 printf("\x1b[33mEXPECT_LT( %.3e , %.3e ) failed:\x1b[0m\n %s, line %d.\n", \ 124 x, y, __FILE__, __LINE__); \ void register_all_tests()
void register_test(void(*testfn)(void), char *name)