Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Crayon2000 committed Nov 4, 2022
1 parent c341dc1 commit 107c1bc
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tests/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,28 +181,36 @@ TEST_CASE("message equality non equal lhs empty", "[message]")

TEST_CASE("message rebuild with size", "[message]")
{
const zmq::message_t msg();
msg.rebuild(5)
zmq::message_t msg;
msg.rebuild(5);
CHECK(msg.size() == 5);
}

#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]")
{
SECTION("string")
{
const std::string hi(data);
zmq::message_t hi_msg();
hi_msg.rebuild(hi)
zmq::message_t hi_msg;
hi_msg.rebuild(hi);
CHECK(2u == hi_msg.size());
CHECK(0 == memcmp(data, hi_msg.data(), 2));
}
#if CPPZMQ_HAS_STRING_VIEW
SECTION("string_view")
{
const std::string_view hi(data);
zmq::message_t hi_msg();
hi_msg.rebuild(hi)
zmq::message_t hi_msg;
hi_msg.rebuild(hi);
CHECK(2u == hi_msg.size());
CHECK(0 == memcmp(data, hi_msg.data(), 2));
}
Expand Down

0 comments on commit 107c1bc

Please sign in to comment.