From 9f0009faeaa0960f57fcacea91b45997258016e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 1 Sep 2015 14:32:27 +0000 Subject: synch more with git svn path=/trunk/externals/iem/iemnet/; revision=17546 --- build/autotests/tests/common.h | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 build/autotests/tests/common.h (limited to 'build/autotests/tests/common.h') 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 +static inline void pass(void) {exit(0); } +static inline void fail(void) {exit(1); } +static inline void skip(void) {exit(77); } + +#include +#include +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 */ + -- cgit v1.2.1