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.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp
index 2657c20..9c77cc4 100644
--- a/tests/test_invalid_rep.cpp
+++ b/tests/test_invalid_rep.cpp
@@ -1,6 +1,7 @@
/*
- Copyright (c) 2007-2011 iMatix Corporation
- Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+ Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2011 VMware, Inc.
+ Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
@@ -20,9 +21,12 @@
#include "../include/zmq.h"
#include <assert.h>
+#include <stdio.h>
int main (int argc, char *argv [])
{
+ fprintf (stderr, "test_invalid_rep running...\n");
+
// Create REQ/XREP wiring.
void *ctx = zmq_init (1);
assert (ctx);
@@ -45,25 +49,26 @@ int main (int argc, char *argv [])
assert (rc == 1);
// Receive the request.
- char addr [4];
- char seqn [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);
- rc = zmq_recv (xrep_socket, seqn, sizeof (seqn), 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_SNDLABEL);
- assert (rc == 4);
- rc = zmq_send (xrep_socket, seqn, 4, ZMQ_SNDLABEL);
- 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);
assert (rc == 1);