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, ...) ((e) ? \
17 _gen_result(1, __func__, __FILE__, __LINE__, \
18 test, ## __VA_ARGS__) : \
19 _gen_result(0, __func__, __FILE__, __LINE__, \
20 test, ## __VA_ARGS__))
22 # define ok1(e) ((e) ? \
23 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
24 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
26 # define pass(test, ...) ok(1, test, ## __VA_ARGS__)
27 # define fail(test, ...) ok(0, test, ## __VA_ARGS__)
29 # define skip_start(test, n, fmt, ...) \
32 skip(n, fmt, ## __VA_ARGS__); \
35 #elif __STDC_VERSION__ >= 199901L /* __GNUC__ */
36 # define ok(e, ...) ((e) ? \
37 _gen_result(1, __func__, __FILE__, __LINE__, \
39 _gen_result(0, __func__, __FILE__, __LINE__, \
42 # define ok1(e) ((e) ? \
43 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
44 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
46 # define pass(...) ok(1, __VA_ARGS__)
47 # define fail(...) ok(0, __VA_ARGS__)
49 # define skip_start(test, n, ...) \
52 skip(n, __VA_ARGS__); \
55 #else /* __STDC_VERSION__ */
56 # error "Needs gcc or C99 compiler for variadic macros."
57 #endif /* __STDC_VERSION__ */
59 #define skip_end() } while(0);
61 #ifdef __MINGW_PRINTF_FORMAT
62 # define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
64 # define TAP_PRINTF_FORMAT printf
67 __attribute__((format(TAP_PRINTF_FORMAT
, 5, 6)))
68 unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
70 int plan_no_plan(void);
71 __attribute__((noreturn
))
72 int plan_skip_all(const char *);
73 int plan_tests(unsigned int);
75 __attribute__((format(TAP_PRINTF_FORMAT
, 1, 2)))
76 unsigned int diag(const char *, ...);
77 void diag_multiline(const char *);
79 __attribute__((format(TAP_PRINTF_FORMAT
, 2, 3)))
80 int skip(unsigned int, const char *, ...);
82 __attribute__((format(TAP_PRINTF_FORMAT
, 1, 2)))
83 void todo_start(const char *, ...);
86 int exit_status(void);
This page took 0.03313 seconds and 5 git commands to generate.