mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-13 10:52:57 +01:00
Fix unit tests
This commit is contained in:
parent
c341dc1dd2
commit
107c1bc4e2
@ -181,19 +181,27 @@ TEST_CASE("message equality non equal lhs empty", "[message]")
|
|||||||
|
|
||||||
TEST_CASE("message rebuild with size", "[message]")
|
TEST_CASE("message rebuild with size", "[message]")
|
||||||
{
|
{
|
||||||
const zmq::message_t msg();
|
zmq::message_t msg;
|
||||||
msg.rebuild(5)
|
msg.rebuild(5);
|
||||||
CHECK(msg.size() == 5);
|
CHECK(msg.size() == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
|
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
|
||||||
|
TEST_CASE("message rebuild with string literal", "[message]")
|
||||||
|
{
|
||||||
|
zmq::message_t hi_msg;
|
||||||
|
hi_msg.rebuild("Hi");
|
||||||
|
REQUIRE(2u == hi_msg.size());
|
||||||
|
CHECK(0 == memcmp(data, hi_msg.data(), 2));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("message rebuild with strings", "[message]")
|
TEST_CASE("message rebuild with strings", "[message]")
|
||||||
{
|
{
|
||||||
SECTION("string")
|
SECTION("string")
|
||||||
{
|
{
|
||||||
const std::string hi(data);
|
const std::string hi(data);
|
||||||
zmq::message_t hi_msg();
|
zmq::message_t hi_msg;
|
||||||
hi_msg.rebuild(hi)
|
hi_msg.rebuild(hi);
|
||||||
CHECK(2u == hi_msg.size());
|
CHECK(2u == hi_msg.size());
|
||||||
CHECK(0 == memcmp(data, hi_msg.data(), 2));
|
CHECK(0 == memcmp(data, hi_msg.data(), 2));
|
||||||
}
|
}
|
||||||
@ -201,8 +209,8 @@ TEST_CASE("message rebuild with strings", "[message]")
|
|||||||
SECTION("string_view")
|
SECTION("string_view")
|
||||||
{
|
{
|
||||||
const std::string_view hi(data);
|
const std::string_view hi(data);
|
||||||
zmq::message_t hi_msg();
|
zmq::message_t hi_msg;
|
||||||
hi_msg.rebuild(hi)
|
hi_msg.rebuild(hi);
|
||||||
CHECK(2u == hi_msg.size());
|
CHECK(2u == hi_msg.size());
|
||||||
CHECK(0 == memcmp(data, hi_msg.data(), 2));
|
CHECK(0 == memcmp(data, hi_msg.data(), 2));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user