1 #define lu_assert_msg(expr, ...) \
3 fprintf(stdout, "Failure in file %s at line %i\n", __FILE__, __LINE__); \
4 fprintf(stdout, ## __VA_ARGS__); \
8 #define lu_assert(expr) \
9 lu_assert_msg(expr, "");
11 /* OP may be any comparison operator. */
13 #define _lu_assert_int(X, OP, Y) do { \
16 lu_assert_msg(_lu_x OP _lu_y, \
17 "Assertion '"#X#OP#Y"' failed: "#X"==%i, "#Y"==%i\n", \
20 #define lu_assert_int_eq(X, Y) _lu_assert_int(X, ==, Y)
21 #define lu_assert_int_ne(X, Y) _lu_assert_int(X, !=, Y)
22 #define lu_assert_int_lt(X, Y) _lu_assert_int(X, <, Y)
23 #define lu_assert_int_le(X, Y) _lu_assert_int(X, <=, Y)
24 #define lu_assert_int_gt(X, Y) _lu_assert_int(X, >, Y)
25 #define lu_assert_int_ge(X, Y) _lu_assert_int(X, >=, Y)
27 #define _lu_assert_dbl(X, OP, Y) do { \
30 lu_assert_msg(_lu_x OP _lu_y, \
31 "Assertion '"#X#OP#Y"' failed: "#X"==%g, "#Y"==%g", \
34 #define lu_assert_dbl_eq(X, Y) _lu_assert_dbl(X, ==, Y)
35 #define lu_assert_dbl_ne(X, Y) _lu_assert_dbl(X, !=, Y)
36 #define lu_assert_dbl_lt(X, Y) _lu_assert_dbl(X, <, Y)
37 #define lu_assert_dbl_le(X, Y) _lu_assert_dbl(X, <=, Y)
38 #define lu_assert_dbl_gt(X, Y) _lu_assert_dbl(X, >, Y)
39 #define lu_assert_dbl_ge(X, Y) _lu_assert_dbl(X, >=, Y)