Problem: message_t to string is hard

Solution: add to_string() function.
This commit is contained in:
Gudmundur Adalsteinsson
2020-01-07 19:54:47 +00:00
parent de07119a92
commit 4f9c2ea519
2 changed files with 31 additions and 3 deletions

View File

@@ -151,6 +151,18 @@ TEST_CASE("message equality non equal lhs empty", "[message]")
CHECK(msg_a != msg_b);
}
TEST_CASE("message to string", "[message]")
{
const zmq::message_t a;
const zmq::message_t b("Foo", 3);
CHECK(a.to_string() == "");
CHECK(b.to_string() == "Foo");
#ifdef ZMQ_CPP17
CHECK(a.to_string_view() == "");
CHECK(b.to_string_view() == "Foo");
#endif
}
#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0)
TEST_CASE("message routing id persists", "[message]")
{