7 #define _END } while(0);
9 /* msg must be a string literal */
10 #define _ASSERT(expr, msg, ...) _BEGIN \
12 fprintf(stderr, "Assertion failed: " msg "\n", __VA_ARGS__); \
16 #define SUCCEED _BEGIN return 1; _END
17 #define ASSERT(expr) _ASSERT(expr, "%s", #expr)
18 /* This macro is meant for int-like things that can print with %d */
19 #define ASSERT_EQUAL(expected, actual) _ASSERT((expected) == (actual), \
20 "%s == %s (expected %d, was %d)", \
21 #actual, #expected, expected, actual);
22 #define ASSERT_NOT_EQUAL(unexpected, actual) _ASSERT((unexpected) != (actual), \
23 "%s != %s (expected not to be %d but was)", \
24 #actual, #unexpected, unexpected);
26 struct TestDescription {
28 int (*testfunc)(void);
31 #endif /* GLKUNIT_H */