summaryrefslogtreecommitdiff
path: root/tests/utils.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-09-19 14:55:24 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-09-19 19:06:45 +0200
commite4b0eb1975e4ac76c5cfff622f254cf16dcdfc33 (patch)
treed6b04fa7a06c67de271e06e8dcc85f6b3a5be9d8 /tests/utils.h
parent898b93f47aec2f0280123538804c2a299b5de25d (diff)
downloadgnutls-e4b0eb1975e4ac76c5cfff622f254cf16dcdfc33.tar.gz
tests: added the macros test_fail() and test_success()
These macros allow test programs which run multiple checks, to report the name of the check failed. Modified mini-server-name and x509-dn-decode to use the macro.
Diffstat (limited to 'tests/utils.h')
-rw-r--r--tests/utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/utils.h b/tests/utils.h
index 213f5834c1..c8efe49b3a 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -63,6 +63,13 @@ extern void fail_ignore(const char *format, ...)
extern void success(const char *format, ...)
__attribute__ ((format(printf, 1, 2)));
+/* assumes test_name is defined */
+#define test_fail(fmt, ...) \
+ fail("%s: "fmt, test_name, ##__VA_ARGS__)
+
+#define test_success(fmt, ...) \
+ success("%s: "fmt, test_name, ##__VA_ARGS__)
+
extern void c_print(const unsigned char *str, size_t len);
extern void escapeprint(const char *str, size_t len);
extern void hexprint(const void *str, size_t len);