Commit | Line | Data |
---|---|---|
ed545d36 MJ |
1 | /* |
2 | * SPDX-License-Identifier: BSD-2-Clause | |
1b387491 | 3 | * |
ed545d36 MJ |
4 | * Copyright (C) 2004 Nik Clayton |
5 | * Copyright (C) 2017 Jérémie Galarneau | |
1b387491 MJ |
6 | */ |
7 | ||
153b081a SM |
8 | #ifdef __cplusplus |
9 | extern "C" { | |
10 | #endif | |
11 | ||
1b387491 MJ |
12 | # define ok(e, ...) ((e) ? \ |
13 | _gen_result(1, __func__, __FILE__, __LINE__, \ | |
14 | __VA_ARGS__) : \ | |
15 | _gen_result(0, __func__, __FILE__, __LINE__, \ | |
16 | __VA_ARGS__)) | |
17 | ||
18 | # define ok1(e) ((e) ? \ | |
19 | _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ | |
20 | _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) | |
21 | ||
95720c6d MD |
22 | # define pass(...) ok(1, __VA_ARGS__) |
23 | # define fail(...) ok(0, __VA_ARGS__) | |
1b387491 MJ |
24 | |
25 | # define skip_start(test, n, ...) \ | |
26 | do { \ | |
27 | if((test)) { \ | |
28 | skip(n, __VA_ARGS__); \ | |
29 | continue; \ | |
30 | } | |
1b387491 MJ |
31 | |
32 | #define skip_end() } while(0); | |
33 | ||
ed545d36 MJ |
34 | #ifdef __MINGW_PRINTF_FORMAT |
35 | # define TAP_PRINTF_FORMAT __MINGW_PRINTF_FORMAT | |
36 | #else | |
37 | # define TAP_PRINTF_FORMAT printf | |
38 | #endif | |
39 | ||
40 | __attribute__((format(TAP_PRINTF_FORMAT, 5, 6))) | |
41 | unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...); | |
1b387491 MJ |
42 | |
43 | int plan_no_plan(void); | |
6fa8b4f8 | 44 | __attribute__((__noreturn__)) |
ed545d36 | 45 | int plan_skip_all(const char *); |
1b387491 MJ |
46 | int plan_tests(unsigned int); |
47 | ||
ed545d36 MJ |
48 | __attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) |
49 | unsigned int diag(const char *, ...); | |
50 | void diag_multiline(const char *); | |
1b387491 | 51 | |
ed545d36 MJ |
52 | __attribute__((format(TAP_PRINTF_FORMAT, 2, 3))) |
53 | int skip(unsigned int, const char *, ...); | |
1b387491 | 54 | |
ed545d36 MJ |
55 | __attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) |
56 | void todo_start(const char *, ...); | |
1b387491 MJ |
57 | void todo_end(void); |
58 | ||
59 | int exit_status(void); | |
ad460058 MD |
60 | |
61 | void tap_disable(void); | |
62 | ||
63 | unsigned int rdiag_start(void); | |
ed545d36 MJ |
64 | __attribute__((format(TAP_PRINTF_FORMAT, 1, 2))) |
65 | unsigned int rdiag(const char *fmt, ...); | |
ad460058 | 66 | unsigned int rdiag_end(void); |
153b081a SM |
67 | |
68 | #ifdef __cplusplus | |
69 | } | |
70 | #endif |