File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,27 @@ static_assert(std::is_nothrow_swappable<zmq::socket_t>::value,
99 " socket_t should be nothrow swappable" );
1010#endif
1111
12+ TEST_CASE (" socket default ctor" , " [socket]" )
13+ {
14+ zmq::socket_t socket;
15+ }
16+
1217TEST_CASE (" socket create destroy" , " [socket]" )
1318{
1419 zmq::context_t context;
1520 zmq::socket_t socket (context, ZMQ_ROUTER);
1621}
1722
1823#ifdef ZMQ_CPP11
24+ TEST_CASE (" socket create assign" , " [socket]" )
25+ {
26+ zmq::context_t context;
27+ zmq::socket_t socket (context, ZMQ_ROUTER);
28+ CHECK (static_cast <void *>(socket));
29+ socket = {};
30+ CHECK (!static_cast <void *>(socket));
31+ }
32+
1933TEST_CASE (" socket create by enum and destroy" , " [socket]" )
2034{
2135 zmq::context_t context;
Original file line number Diff line number Diff line change @@ -646,6 +646,12 @@ class socket_t
646646 friend class monitor_t ;
647647
648648 public:
649+ socket_t () ZMQ_NOTHROW
650+ : ptr(ZMQ_NULLPTR)
651+ , ctxptr(ZMQ_NULLPTR)
652+ {
653+ }
654+
649655 socket_t (context_t &context_, int type_)
650656 : ptr(zmq_socket(static_cast <void *>(context_), type_))
651657 , ctxptr(static_cast <void *>(context_))
You can’t perform that action at this time.
0 commit comments