2 * Copyright (c) 2004 Nik Clayton
3 * 2017 Jérémie Galarneau
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 /* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting
29 and requires the caller to add the final comma if they've ommitted
30 the optional arguments */
32 # define ok(e, test, ...) ((e) ? \
33 _gen_result(1, __func__, __FILE__, __LINE__, \
34 test, ## __VA_ARGS__) : \
35 _gen_result(0, __func__, __FILE__, __LINE__, \
36 test, ## __VA_ARGS__))
38 # define ok1(e) ((e) ? \
39 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
40 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
42 # define pass(test, ...) ok(1, test, ## __VA_ARGS__);
43 # define fail(test, ...) ok(0, test, ## __VA_ARGS__);
45 # define skip_start(test, n, fmt, ...) \
48 skip(n, fmt, ## __VA_ARGS__); \
51 #elif __STDC_VERSION__ >= 199901L /* __GNUC__ */
52 # define ok(e, ...) ((e) ? \
53 _gen_result(1, __func__, __FILE__, __LINE__, \
55 _gen_result(0, __func__, __FILE__, __LINE__, \
58 # define ok1(e) ((e) ? \
59 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
60 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
62 # define pass(...) ok(1, __VA_ARGS__);
63 # define fail(...) ok(0, __VA_ARGS__);
65 # define skip_start(test, n, ...) \
68 skip(n, __VA_ARGS__); \
71 #else /* __STDC_VERSION__ */
72 # error "Needs gcc or C99 compiler for variadic macros."
73 #endif /* __STDC_VERSION__ */
75 #define skip_end() } while(0);
77 #ifdef __MINGW_PRINTF_FORMAT
78 # define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
80 # define TAP_PRINTF_FORMAT printf
83 __attribute__((format(TAP_PRINTF_FORMAT
, 5, 6)))
84 unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
86 int plan_no_plan(void);
87 __attribute__((noreturn
))
88 int plan_skip_all(const char *);
89 int plan_tests(unsigned int);
91 __attribute__((format(TAP_PRINTF_FORMAT
, 1, 2)))
92 unsigned int diag(const char *, ...);
93 void diag_multiline(const char *);
95 __attribute__((format(TAP_PRINTF_FORMAT
, 2, 3)))
96 int skip(unsigned int, const char *, ...);
98 __attribute__((format(TAP_PRINTF_FORMAT
, 1, 2)))
99 void todo_start(const char *, ...);
102 int exit_status(void);
This page took 0.031975 seconds and 4 git commands to generate.