2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (C) 2004 Nik Clayton
5 * Copyright (C) 2017 Jérémie Galarneau
12 /* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting
13 and requires the caller to add the final comma if they've ommitted
14 the optional arguments */
16 #define ok(e, test, ...) \
17 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__) : \
18 _gen_result(0, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__))
21 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
22 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
24 #define pass(test, ...) ok(1, test, ##__VA_ARGS__)
25 #define fail(test, ...) ok(0, test, ##__VA_ARGS__)
27 #define skip_start(test, n, fmt, ...) \
30 skip(n, fmt, ##__VA_ARGS__); \
33 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* __GNUC__ */
35 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, __VA_ARGS__) : \
36 _gen_result(0, __func__, __FILE__, __LINE__, __VA_ARGS__))
39 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
40 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
42 #define pass(...) ok(1, __VA_ARGS__)
43 #define fail(...) ok(0, __VA_ARGS__)
45 #define skip_start(test, n, ...) \
48 skip(n, __VA_ARGS__); \
51 #else /* __STDC_VERSION__ */
52 #error "Needs gcc or C99 compiler for variadic macros."
53 #endif /* __STDC_VERSION__ */
60 #ifdef __MINGW_PRINTF_FORMAT
61 #define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
63 #define TAP_PRINTF_FORMAT printf
66 __attribute__((format(TAP_PRINTF_FORMAT
, 5, 6))) unsigned int
67 _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
69 int plan_no_plan(void);
70 __attribute__((noreturn
)) int plan_skip_all(const char *);
71 int plan_tests(unsigned int);
73 __attribute__((format(TAP_PRINTF_FORMAT
, 1, 2))) unsigned int diag(const char *, ...);
74 void diag_multiline(const char *);
76 __attribute__((format(TAP_PRINTF_FORMAT
, 2, 3))) int skip(unsigned int, const char *, ...);
78 __attribute__((format(TAP_PRINTF_FORMAT
, 1, 2))) void todo_start(const char *, ...);
81 int exit_status(void);
This page took 0.030839 seconds and 4 git commands to generate.