]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/blobdiff - src/wvtest/c/wvtest.h
wvtest: WVFAIL(cond) returns cond
[frescor/frsh-forb.git] / src / wvtest / c / wvtest.h
index 0f0bb8acabef5163783333db609fe158a9025d66..8530ba533d8641d3f9c7253a9a489b9fe49b5ee1 100644 (file)
@@ -60,9 +60,11 @@ int wvtest_start_check_frsh(const char *file, int line,
     wvtest_start_check_eq_str(__FILE__, __LINE__, (a), (b), true)
 #define WVPASSLTSTR(a, b) \
     wvtest_start_check_lt_str(__FILE__, __LINE__, (a), (b))
-#define WVFAIL(cond) \
-    wvtest_start_check(__FILE__, __LINE__, "NOT(" #cond ")", !(cond))
-#define WVFAILEQ(a, b) \
+#define WVFAIL(cond)                                                   \
+       ({ typeof (cond) cond_ = (cond);                                \
+          wvtest_start_check(__FILE__, __LINE__, "NOT(" #cond ")", !(cond_)); \
+          cond_; })
+#define WVFAILEQ(a, b)                                                 \
        wvtest_start_check_eq(__FILE__, __LINE__, (a), (b), false, #a, #b)
 #define WVFAILEQSTR(a, b) \
        wvtest_start_check_eq_str(__FILE__, __LINE__, (a), (b), false)