curlcheck.h: add fail()
authorDaniel Stenberg <daniel@haxx.se>
Tue, 4 Jan 2011 22:09:19 +0000 (23:09 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 4 Jan 2011 22:13:10 +0000 (23:13 +0100)
fail is a new function/macro that a test case can use to indicate a test
failure for cases when the standard macros are not sufficient.

tests/unit/curlcheck.h

index 88ee80a..57babe5 100644 (file)
     unitfail++;                                                         \
   }
 
+/* fail() is for when the test case figured out by itself that a check
+   proved a failure */
+#define fail(msg) do {                                                 \
+    fprintf(stderr, "%s:%d test failed: '%s'\n",                       \
+            __FILE__, __LINE__, msg);                                  \
+    unitfail++;                                                        \
+  } while(0)
+
+
+
 extern int unitfail;
 
 #define UNITTEST_START                          \