summaryrefslogtreecommitdiff
path: root/tests/test_invalid_rep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_invalid_rep.cpp')
-rw-r--r--tests/test_invalid_rep.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp
index ada7ee1..9c77cc4 100644
--- a/tests/test_invalid_rep.cpp
+++ b/tests/test_invalid_rep.cpp
@@ -25,7 +25,7 @@
int main (int argc, char *argv [])
{
- fprintf (stderr, "test_pair_inproc running...\n");
+ fprintf (stderr, "test_invalid_rep running...\n");
// Create REQ/XREP wiring.
void *ctx = zmq_init (1);
@@ -49,23 +49,24 @@ int main (int argc, char *argv [])
assert (rc == 1);
// Receive the request.
- char addr [4];
+ char addr [32];
+ int addr_size;
char bottom [1];
char body [1];
- rc = zmq_recv (xrep_socket, addr, sizeof (addr), 0);
- assert (rc == 4);
+ addr_size = zmq_recv (xrep_socket, addr, sizeof (addr), 0);
+ assert (addr_size >= 0);
rc = zmq_recv (xrep_socket, bottom, sizeof (bottom), 0);
assert (rc == 0);
rc = zmq_recv (xrep_socket, body, sizeof (body), 0);
assert (rc == 1);
// Send invalid reply.
- rc = zmq_send (xrep_socket, addr, 4, 0);
- assert (rc == 4);
+ rc = zmq_send (xrep_socket, addr, addr_size, 0);
+ assert (rc == addr_size);
// Send valid reply.
- rc = zmq_send (xrep_socket, addr, 4, ZMQ_SNDMORE);
- assert (rc == 4);
+ rc = zmq_send (xrep_socket, addr, addr_size, ZMQ_SNDMORE);
+ assert (rc == addr_size);
rc = zmq_send (xrep_socket, bottom, 0, ZMQ_SNDMORE);
assert (rc == 0);
rc = zmq_send (xrep_socket, "b", 1, 0);