Added zmq_send_const test

This commit is contained in:
Uli Köhler 2013-08-17 20:37:07 +02:00
parent e2c322cf80
commit 10becae7eb

View File

@ -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);