aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-12-27 18:10:33 -0800
committerGarrett D'Amore <garrett@damore.org>2019-12-27 18:17:57 -0800
commit6b7beeaa13c61d447e91fdfbb8431cdce6aeee99 (patch)
treef2295524e1ae6ab8f3d1d2fff16f69942a2c1ed0
parentddc078b98b2014e570969bd277936ffe0684f005 (diff)
downloadnng-6b7beeaa13c61d447e91fdfbb8431cdce6aeee99.tar.gz
nng-6b7beeaa13c61d447e91fdfbb8431cdce6aeee99.tar.bz2
nng-6b7beeaa13c61d447e91fdfbb8431cdce6aeee99.zip
Test output might be misleading
-rw-r--r--tests/testutil.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/testutil.h b/tests/testutil.h
index b3c3bbd2..ab792557 100644
--- a/tests/testutil.h
+++ b/tests/testutil.h
@@ -44,20 +44,22 @@ extern int testutil_marry(nng_socket, nng_socket);
// TEST_NNG_PASS tests for NNG success. It reports the failure if it
// did not.
-#define TEST_NNG_PASS(cond) \
- do { \
- int result_ = (cond); \
- TEST_CHECK_(result_ == 0, "%s failed: %s (%d)", #cond, \
- nng_strerror(result_), result_); \
+#define TEST_NNG_PASS(cond) \
+ do { \
+ int result_ = (cond); \
+ TEST_CHECK_(result_ == 0, "%s succeeds", #cond); \
+ TEST_MSG("%s: expected success, got %s (%d)", #cond, \
+ nng_strerror(result_), result_); \
} while (0)
-#define TEST_NNG_FAIL(cond, expect) \
- do { \
- int result_ = (cond); \
- TEST_CHECK_(result_ == expect, \
- "%s: expected %s (%d), got %s (%d)", #cond, \
- nng_strerror(expect), expect, nng_strerror(result_), \
- result_); \
+#define TEST_NNG_FAIL(cond, expect) \
+ do { \
+ int result_ = (cond); \
+ TEST_CHECK_(result_ == expect, "%s fails with %s", #cond, \
+ nng_strerror(expect)); \
+ TEST_MSG("%s: expected %s (%d), got %s (%d)", #cond, \
+ nng_strerror(expect), expect, nng_strerror(result_), \
+ result_); \
} while (0)
#ifdef __cplusplus