Build system: use SPDX identifiers
[urcu.git] / tests / utils / tap.h
... / ...
CommitLineData
1/*
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (C) 2004 Nik Clayton
5 * Copyright (C) 2017 Jérémie Galarneau
6 */
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
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
22# define pass(...) ok(1, __VA_ARGS__)
23# define fail(...) ok(0, __VA_ARGS__)
24
25# define skip_start(test, n, ...) \
26 do { \
27 if((test)) { \
28 skip(n, __VA_ARGS__); \
29 continue; \
30 }
31
32#define skip_end() } while(0);
33
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)))
41unsigned int _gen_result(int, const char *, const char *, unsigned int, const char *, ...);
42
43int plan_no_plan(void);
44__attribute__((__noreturn__))
45int plan_skip_all(const char *);
46int plan_tests(unsigned int);
47
48__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
49unsigned int diag(const char *, ...);
50void diag_multiline(const char *);
51
52__attribute__((format(TAP_PRINTF_FORMAT, 2, 3)))
53int skip(unsigned int, const char *, ...);
54
55__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
56void todo_start(const char *, ...);
57void todo_end(void);
58
59int exit_status(void);
60
61void tap_disable(void);
62
63unsigned int rdiag_start(void);
64__attribute__((format(TAP_PRINTF_FORMAT, 1, 2)))
65unsigned int rdiag(const char *fmt, ...);
66unsigned int rdiag_end(void);
67
68#ifdef __cplusplus
69}
70#endif
This page took 0.022428 seconds and 4 git commands to generate.