diff options
Diffstat (limited to 'tests/gpg/t-support.h')
-rw-r--r-- | tests/gpg/t-support.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index db69dd0e..f6dec682 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -48,6 +48,34 @@ while (0) +#ifdef GPGRT_HAVE_MACRO_FUNCTION +void GPGRT_ATTR_NORETURN +_test (const char *expr, const char *file, int line, + const char *func) +{ + fprintf (stderr, "Test \"%s\" in %s failed (%s:%d)\n", + expr, func, file, line); + exit (1); +} +# define test(expr) \ + ((expr) \ + ? (void) 0 \ + : _test (#expr, __FILE__, __LINE__, __FUNCTION__)) +#else /*!GPGRT_HAVE_MACRO_FUNCTION*/ +void +_test (const char *expr, const char *file, int line) +{ + fprintf (stderr, "Test \"%s\" failed (%s:%d)\n", + expr, file, line); + exit (1); +} +# define test(expr) \ + ((expr) \ + ? (void) 0 \ + : _test (#expr, __FILE__, __LINE__)) +#endif /*!GPGRT_HAVE_MACRO_FUNCTION*/ + + static const char * nonnull (const char *s) { |