mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Added zmq_send_const test
This commit is contained in:
parent
e2c322cf80
commit
10becae7eb
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user