summaryrefslogtreecommitdiffstats
path: root/tap/tap.h
diff options
context:
space:
mode:
Diffstat (limited to 'tap/tap.h')
-rw-r--r--tap/tap.h60
1 files changed, 27 insertions, 33 deletions
diff --git a/tap/tap.h b/tap/tap.h
index 8ee525c..5abbd76 100644
--- a/tap/tap.h
+++ b/tap/tap.h
@@ -28,52 +28,46 @@
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) ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
38 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
39 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
40 36
41# define pass(test, ...) ok(1, test, ## __VA_ARGS__); 37# define pass(test, ...) ok(1, test, ##__VA_ARGS__);
42# define fail(test, ...) ok(0, test, ## __VA_ARGS__); 38# define fail(test, ...) ok(0, test, ##__VA_ARGS__);
43 39
44# define skip_start(test, n, fmt, ...) \ 40# define skip_start(test, n, fmt, ...) \
45 do { \ 41 do { \
46 if((test)) { \ 42 if ((test)) { \
47 skip(n, fmt, ## __VA_ARGS__); \ 43 skip(n, fmt, ##__VA_ARGS__); \
48 continue; \ 44 continue; \
49 } 45 }
50#else /* __GNUC__ */ 46#else /* __GNUC__ */
51/* The original tap.h used to test if __STDC_VERSION__ >= 199901L here. This 47/* 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 48 * 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 49 * sure how to add an exception here for HP-UX so I just removed the check
54 * for now */ 50 * for now */
55# define ok(e, ...) ((e) ? \ 51# define ok(e, ...) \
56 _gen_result(1, __func__, __FILE__, __LINE__, \ 52 ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, __VA_ARGS__) : _gen_result(0, __func__, __FILE__, __LINE__, __VA_ARGS__))
57 __VA_ARGS__) : \
58 _gen_result(0, __func__, __FILE__, __LINE__, \
59 __VA_ARGS__))
60 53
61# define ok1(e) ((e) ? \ 54# define ok1(e) ((e) ? _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
62 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
63 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
64 55
65# define pass(...) ok(1, __VA_ARGS__); 56# define pass(...) ok(1, __VA_ARGS__);
66# define fail(...) ok(0, __VA_ARGS__); 57# define fail(...) ok(0, __VA_ARGS__);
67 58
68# define skip_start(test, n, ...) \ 59# define skip_start(test, n, ...) \
69 do { \ 60 do { \
70 if((test)) { \ 61 if ((test)) { \
71 skip(n, __VA_ARGS__); \ 62 skip(n, __VA_ARGS__); \
72 continue; \ 63 continue; \
73 } 64 }
74#endif /* __GNUC__ */ 65#endif /* __GNUC__ */
75 66
76# define skip_end } while(0); 67#define skip_end \
68 } \
69 while (0) \
70 ;
77 71
78unsigned int _gen_result(int, const char *, char *, unsigned int, char *, ...); 72unsigned int _gen_result(int, const char *, char *, unsigned int, char *, ...);
79 73