summaryrefslogtreecommitdiffstats
path: root/tap/tap.h
diff options
context:
space:
mode:
Diffstat (limited to 'tap/tap.h')
-rw-r--r--tap/tap.h65
1 files changed, 32 insertions, 33 deletions
diff --git a/tap/tap.h b/tap/tap.h
index 8ee525c8..0c550bfd 100644
--- a/tap/tap.h
+++ b/tap/tap.h
@@ -28,52 +28,51 @@
28 and requires the caller to add the final comma if they've omitted 28 and requires the caller to add the final comma if they've omitted
29 the optional arguments */ 29 the optional arguments */
30#ifdef __GNUC__ 30#ifdef __GNUC__
31# define ok(e, test, ...) ((e) ? \ 31# define ok(e, test, ...) \
32 _gen_result(1, __func__, __FILE__, __LINE__, \ 32 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__) \
33 test, ## __VA_ARGS__) : \ 33 : _gen_result(0, __func__, __FILE__, __LINE__, test, ##__VA_ARGS__))
34 _gen_result(0, __func__, __FILE__, __LINE__, \
35 test, ## __VA_ARGS__))
36 34
37# define ok1(e) ((e) ? \ 35# define ok1(e) \
38 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ 36 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) \
39 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) 37 : _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
40 38
41# define pass(test, ...) ok(1, test, ## __VA_ARGS__); 39# define pass(test, ...) ok(1, test, ##__VA_ARGS__);
42# define fail(test, ...) ok(0, test, ## __VA_ARGS__); 40# define fail(test, ...) ok(0, test, ##__VA_ARGS__);
43 41
44# define skip_start(test, n, fmt, ...) \ 42# define skip_start(test, n, fmt, ...) \
45 do { \ 43 do { \
46 if((test)) { \ 44 if ((test)) { \
47 skip(n, fmt, ## __VA_ARGS__); \ 45 skip(n, fmt, ##__VA_ARGS__); \
48 continue; \ 46 continue; \
49 } 47 }
50#else /* __GNUC__ */ 48#else /* __GNUC__ */
51/* The original tap.h used to test if __STDC_VERSION__ >= 199901L here. This 49/* The original tap.h used to test if __STDC_VERSION__ >= 199901L here. This
52 * doesn't seem to work on HP-UX even though the code compile fine. I'm not 50 * doesn't seem to work on HP-UX even though the code compile fine. I'm not
53 * sure how to add an exception here for HP-UX so I just removed the check 51 * sure how to add an exception here for HP-UX so I just removed the check
54 * for now */ 52 * for now */
55# define ok(e, ...) ((e) ? \ 53# define ok(e, ...) \
56 _gen_result(1, __func__, __FILE__, __LINE__, \ 54 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, __VA_ARGS__) \
57 __VA_ARGS__) : \ 55 : _gen_result(0, __func__, __FILE__, __LINE__, __VA_ARGS__))
58 _gen_result(0, __func__, __FILE__, __LINE__, \
59 __VA_ARGS__))
60 56
61# define ok1(e) ((e) ? \ 57# define ok1(e) \
62 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ 58 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) \
63 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) 59 : _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
64 60
65# define pass(...) ok(1, __VA_ARGS__); 61# define pass(...) ok(1, __VA_ARGS__);
66# define fail(...) ok(0, __VA_ARGS__); 62# define fail(...) ok(0, __VA_ARGS__);
67 63
68# define skip_start(test, n, ...) \ 64# define skip_start(test, n, ...) \
69 do { \ 65 do { \
70 if((test)) { \ 66 if ((test)) { \
71 skip(n, __VA_ARGS__); \ 67 skip(n, __VA_ARGS__); \
72 continue; \ 68 continue; \
73 } 69 }
74#endif /* __GNUC__ */ 70#endif /* __GNUC__ */
75 71
76# define skip_end } while(0); 72#define skip_end \
73 } \
74 while (0) \
75 ;
77 76
78unsigned int _gen_result(int, const char *, char *, unsigned int, char *, ...); 77unsigned int _gen_result(int, const char *, char *, unsigned int, char *, ...);
79 78