diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-01-01 17:33:42 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-01-03 19:38:10 +0100 |
commit | 35e1d6538a8767526b9cae66134441b146503a21 (patch) | |
tree | 871888fc2da33021b88546f78c33e90add2d675b /tests/unit/curlcheck.h | |
parent | 45cea7196870f2b5e7096a619dc1a9725295ca1a (diff) | |
download | curl-35e1d6538a8767526b9cae66134441b146503a21.tar.gz |
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.h | 31 |
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; \ + } + |