aboutsummaryrefslogtreecommitdiff
path: root/src/testing/nuts.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-12 15:39:06 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-12 15:39:06 -0800
commitd6de9bec7f1dbb969e872aa9e51103d70dee2316 (patch)
tree606636492af384c7f09436b5b66fb960788e38c8 /src/testing/nuts.h
parent9368d350f363597fb59ac85cada364c42793f0e2 (diff)
downloadnng-d6de9bec7f1dbb969e872aa9e51103d70dee2316.tar.gz
nng-d6de9bec7f1dbb969e872aa9e51103d70dee2316.tar.bz2
nng-d6de9bec7f1dbb969e872aa9e51103d70dee2316.zip
tests: start using nng_err in NUTS
Diffstat (limited to 'src/testing/nuts.h')
-rw-r--r--src/testing/nuts.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/testing/nuts.h b/src/testing/nuts.h
index 290af723..d821b359 100644
--- a/src/testing/nuts.h
+++ b/src/testing/nuts.h
@@ -84,14 +84,14 @@ extern void nuts_scratch_addr_zero(const char *, size_t, char *);
// nuts_marry connects two sockets using inproc. It uses socket
// pipe hooks to ensure that it does not return before both sockets
// are fully connected.
-extern int nuts_marry(nng_socket, nng_socket);
+extern nng_err nuts_marry(nng_socket, nng_socket);
// nuts_marry_ex is like nuts_marry, but returns the pipes that
// were connected, and includes an optional URL. The pipe pointers and the
// URL may be NULL if not needed. If a port number is part of the URL
// and is zero (i.e. if the URL contains :0) then listen is done first,
// and the actual bound port will be used for the client.
-extern int nuts_marry_ex(
+extern nng_err nuts_marry_ex(
nng_socket, nng_socket, const char *, nng_pipe *, nng_pipe *);
// nuts_stream_send_start and nuts_stream_recv_start are used
@@ -208,21 +208,21 @@ extern const char *nuts_ecdsa_client_crt;
// did not.
#define NUTS_PASS(cond) \
do { \
- int result_ = (cond); \
- TEST_ASSERT_(result_ == 0, \
+ nng_err result_ = (nng_err) (cond); \
+ TEST_ASSERT_(result_ == NNG_OK, \
"%s: expected success, got %s (%d)", #cond, \
nng_strerror(result_), result_); \
} while (0)
// NUTS_FAIL tests for a specific NNG error code.
-#define NUTS_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_); \
+#define NUTS_FAIL(cond, expect) \
+ do { \
+ nng_err result_ = (cond); \
+ TEST_CHECK_(result_ == (nng_err) (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)
#define NUTS_SEND(sock, string) \