diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2015-09-01 14:32:27 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2015-09-01 14:32:27 +0000 |
commit | 9f0009faeaa0960f57fcacea91b45997258016e0 (patch) | |
tree | f434613d74c0bebef7abfdbdb67e0bd55f3fa220 /build/autotests/tests/common.h | |
parent | e6f799e41d7910e1388c68630c49bf3141cb8d9c (diff) |
synch more with git
svn path=/trunk/externals/iem/iemnet/; revision=17546
Diffstat (limited to 'build/autotests/tests/common.h')
-rw-r--r-- | build/autotests/tests/common.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/build/autotests/tests/common.h b/build/autotests/tests/common.h new file mode 100644 index 0000000..abef2c8 --- /dev/null +++ b/build/autotests/tests/common.h @@ -0,0 +1,54 @@ +#ifndef TESTS_COMMON_H +#define TESTS_COMMON_H + +#include "iemnet.h" + +#include <stdlib.h> +static inline void pass(void) {exit(0); } +static inline void fail(void) {exit(1); } +static inline void skip(void) {exit(77); } + +#include <stdio.h> +#include <stdarg.h> +static inline void pass_if (int test, int line, const char *format, ...) +{ + if (test) { + va_list argptr ; + printf("@%d: ", line); + va_start (argptr, format) ; + vprintf (format, argptr) ; + va_end (argptr) ; + printf("\n"); + pass(); + } ; +} /* pass_if */ +static inline void skip_if (int test, int line, const char *format, ...) +{ + if (test) { + va_list argptr ; + printf("@%d: ", line); + va_start (argptr, format) ; + vprintf (format, argptr) ; + va_end (argptr) ; + printf("\n"); + skip(); + } ; +} /* skip_if */ +static inline void fail_if (int test, int line, const char *format, ...) +{ + if (test) { + va_list argptr ; + printf("@%d: ", line); + va_start (argptr, format) ; + vprintf (format, argptr) ; + va_end (argptr) ; + printf("\n"); + fail(); + } ; +} /* fail_if */ + +#define STRINGIFY(x) #x +#define STARTTEST(x) printf("============ %s[%04d]:\t%s '%s'\n", __FILE__, __LINE__, __FUNCTION__, x) + +#endif /* TESTS_COMMON_H */ + |