1 #ifndef __obt_unittest_base_h
2 #define __obt_unittest_base_h
9 extern guint g_test_failures
;
10 extern guint g_test_failures_at_test_start
;
11 extern const gchar
* g_active_test_suite
;
12 extern const gchar
* g_active_test_name
;
14 #define ADD_FAILURE() { ++g_test_failures; }
16 #define FAILURE_AT() \
17 fprintf(stderr, "Failure at %s:%u\n", __FILE__, __LINE__); \
20 #define EXPECT_BOOL_EQ(expected, actual) \
21 if ((expected) != (actual)) { \
23 fprintf(stderr, "Expected: %s\nActual: %s\n", \
24 ((expected) ? "true" : "false"), \
25 ((actual) ? "true" : "false")); \
28 #define EXPECT_CHAR_EQ(expected, actual) \
29 if ((expected) != (actual)) { \
31 fprintf(stderr, "Expected: %c\nActual: %c\n", (expected), (actual)); \
34 #define EXPECT_INT_EQ(expected, actual) \
35 if ((expected) != (actual)) { \
37 fprintf(stderr, "Expected: %d\nActual: %d\n", (expected), (actual)); \
40 #define EXPECT_UINT_EQ(expected, actual) \
41 if ((expected) != (actual)) { \
43 fprintf(stderr, "Expected: %u\nActual: %u\n", (expected), (actual)); \
46 #define EXPECT_STRING_EQ(expected, actual) \
47 if ((expected) != (actual)) { \
49 fprintf(stderr, "Expected: %s\nActual: %s\n", \
50 ((expected) ? (expected) : "NULL"), \
51 ((actual) ? (actual) : NULL)); \
54 void unittest_start_suite(const char* suite_name
);
55 void unittest_end_suite();
57 void unittest_start(const char* test_name
);
60 #define TEST_START() unittest_start(__func__);
61 #define TEST_END() unittest_end();