From 10becae7eb7c43e7ec854c5f7d9f365566e1deef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uli=20K=C3=B6hler?= Date: Sat, 17 Aug 2013 20:37:07 +0200 Subject: [PATCH] Added zmq_send_const test --- tests/test_pair_inproc.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp index 6ee651d1..5fd1ec85 100644 --- a/tests/test_pair_inproc.cpp +++ b/tests/test_pair_inproc.cpp @@ -36,6 +36,27 @@ int main (void) assert (rc == 0); bounce (sb, sc); + + // Test zmq_send_const + rc = zmq_send_const (sb, "foo", 3, ZMQ_SNDMORE); + assert (rc == 3); + rc = zmq_send_const (sb, "foobar", 6, 0); + assert (rc == 6); + + zmq_msg_t msg; + rc = zmq_msg_init (&msg); + assert (rc == 0); + rc = zmq_msg_recv (&msg, sc, 0); + assert (rc == 3); + assert (zmq_msg_size (&msg) == 3); + void* data = zmq_msg_data (&msg); + assert (memcmp ("foo", data, 3) == 0); + rc = zmq_msg_recv (&msg, sc, 0); + assert (rc == 6); + data = zmq_msg_data (&msg); + assert (memcmp ("foobar", data, 3) == 0); + + // Cleanup rc = zmq_close (sc); assert (rc == 0);