save
[protos/libecoli.git] / lib / ecoli_test.h
index 1fa8480..1cebe95 100644 (file)
@@ -77,12 +77,16 @@ int ec_test_check_parse(struct ec_node *node, int expected, ...);
        EC_LOG(EC_LOG_ERR, "%s:%d: error: " fmt "\n",                   \
                __FILE__, __LINE__, ##__VA_ARGS__);                     \
 
-#define EC_TEST_ASSERT(cond)                                           \
+/* XXX this is not an assert, it does not abort */
+#define EC_TEST_ASSERT_STR(cond, fmt, ...)                             \
        do {                                                            \
                if (!(cond))                                            \
-                       EC_TEST_ERR("assertion failure: " #cond);       \
+                       EC_TEST_ERR("assert failure: (" #cond ") " fmt, \
+                               ##__VA_ARGS__);                         \
        } while (0)
 
+#define EC_TEST_ASSERT(cond) EC_TEST_ASSERT_STR(cond, "")
+
 /* node, input, [expected1, expected2, ...] */
 #define EC_TEST_CHECK_PARSE(node, args...) ({                          \
        int ret_ = ec_test_check_parse(node, args, EC_NODE_ENDLIST);    \