aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/curlcheck.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-01 17:33:42 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-03 19:38:10 +0100
commit35e1d6538a8767526b9cae66134441b146503a21 (patch)
tree871888fc2da33021b88546f78c33e90add2d675b /tests/unit/curlcheck.h
parent45cea7196870f2b5e7096a619dc1a9725295ca1a (diff)
unittest: framework for unit-testing
This is the first approach at doing fairly clean and easy to write and debug unit tests.
Diffstat (limited to 'tests/unit/curlcheck.h')
-rw-r--r--tests/unit/curlcheck.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/curlcheck.h b/tests/unit/curlcheck.h
new file mode 100644
index 000000000..c34f99093
--- /dev/null
+++ b/tests/unit/curlcheck.h
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ */
+
+#include "test.h"
+
+#define fail_unless(expr, msg) \
+ if(!(expr)) { \
+ fprintf(stderr, "%s:%d Assertion '%s' failed: %s" , \
+ __FILE__, __LINE__, #expr, msg); \
+ unitfail++; \
+ }
+
+extern int unitfail;
+
+#define UNITTEST_START \
+ int test(char *unused) \
+ { \
+ (void)unused; \
+ unit_setup();
+
+#define UNITTEST_STOP \
+ unit_stop(); \
+ return unitfail; \
+ }
+