2018-04-03 12:02:08 +02:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <zmq.hpp>
|
|
|
|
|
2018-05-12 18:28:28 +02:00
|
|
|
TEST(socket, create_destroy)
|
2018-04-03 12:02:08 +02:00
|
|
|
{
|
|
|
|
zmq::context_t context;
|
2018-05-12 18:28:28 +02:00
|
|
|
zmq::socket_t socket(context, ZMQ_ROUTER);
|
2018-04-03 12:02:08 +02:00
|
|
|
}
|
|
|
|
|
2018-04-03 12:04:23 +02:00
|
|
|
#ifdef ZMQ_CPP11
|
2018-05-12 18:28:28 +02:00
|
|
|
TEST(socket, create_by_enum_destroy)
|
2018-04-03 12:04:23 +02:00
|
|
|
{
|
|
|
|
zmq::context_t context;
|
2018-05-12 18:28:28 +02:00
|
|
|
zmq::socket_t socket(context, zmq::socket_type::router);
|
2018-04-03 12:04:23 +02:00
|
|
|
}
|
|
|
|
#endif
|
2018-08-21 13:36:01 +02:00
|
|
|
|
|
|
|
TEST(socket, send_receive_const_buffer)
|
|
|
|
{
|
|
|
|
zmq::context_t context;
|
|
|
|
zmq::socket_t sender(context, ZMQ_PAIR);
|
|
|
|
zmq::socket_t receiver(context, ZMQ_PAIR);
|
|
|
|
receiver.bind("inproc://test");
|
|
|
|
sender.connect("inproc://test");
|
|
|
|
ASSERT_EQ(2, sender.send("Hi", 2));
|
|
|
|
char buf[2];
|
|
|
|
ASSERT_EQ(2, receiver.recv(buf, 2));
|
|
|
|
ASSERT_EQ(0, memcmp(buf, "Hi", 2));
|
|
|
|
}
|