Go to the documentation of this file. 1 #include <catch2/catch_all.hpp>
6 "message_t should not be copy-constructible");
8 "message_t should not be copy-assignable");
10 #if (__cplusplus >= 201703L)
12 "message_t should be nothrow swappable");
15 TEST_CASE(
"message default constructed",
"[message]")
29 swap(message1, message2);
31 CHECK(message2.size() == 0);
32 swap(message1, message2);
40 const char *
const data =
"Hi";
43 TEST_CASE(
"message constructor with iterators",
"[message]")
51 TEST_CASE(
"message constructor with size",
"[message]")
57 TEST_CASE(
"message constructor with buffer and size",
"[message]")
65 TEST_CASE(
"message constructor with char array",
"[message]")
72 #if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
73 TEST_CASE(
"message constructor with container - deprecated",
"[message]")
76 REQUIRE(3u == hi_msg.size());
77 CHECK(0 == memcmp(
data, hi_msg.data(), 3));
80 TEST_CASE(
"message constructor with container of trivial data",
"[message]")
82 int buf[3] = {1, 2, 3};
84 REQUIRE(
sizeof(
buf) == msg.size());
85 CHECK(0 == memcmp(
buf, msg.data(), msg.size()));
88 TEST_CASE(
"message constructor with strings",
"[message]")
94 CHECK(2u == hi_msg.size());
95 CHECK(0 == memcmp(
data, hi_msg.data(), 2));
97 #if CPPZMQ_HAS_STRING_VIEW
98 SECTION(
"string_view")
100 const std::string_view hi(
data);
102 CHECK(2u == hi_msg.size());
103 CHECK(0 == memcmp(
data, hi_msg.data(), 2));
109 #ifdef ZMQ_HAS_RVALUE_REFS
110 TEST_CASE(
"message move constructor",
"[message]")
115 TEST_CASE(
"message assign move empty before",
"[message]")
123 TEST_CASE(
"message assign move empty after",
"[message]")
132 TEST_CASE(
"message assign move empty before and after",
"[message]")
143 CHECK(hi_msg == hi_msg);
150 CHECK(hi_msg_a == hi_msg_b);
157 CHECK(msg_a == msg_b);
164 CHECK(msg_a != msg_b);
167 TEST_CASE(
"message equality non equal rhs empty",
"[message]")
171 CHECK(msg_a != msg_b);
174 TEST_CASE(
"message equality non equal lhs empty",
"[message]")
178 CHECK(msg_a != msg_b);
185 CHECK(
a.to_string() ==
"");
186 CHECK(
b.to_string() ==
"Foo");
187 #if CPPZMQ_HAS_STRING_VIEW
188 CHECK(
a.to_string_view() ==
"");
189 CHECK(
b.to_string_view() ==
"Foo");
192 #if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
199 #if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0)
200 TEST_CASE(
"message routing id persists",
"[message]")
203 msg.set_routing_id(123);
204 CHECK(123u == msg.routing_id());
207 TEST_CASE(
"message group persists",
"[message]")
210 msg.set_group(
"mygroup");
215 #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 2, 0)
224 size_t msg_sz = 1024;
236 size_t msg_sz = 1024;
void swap(message_t &a, message_t &b) ZMQ_NOTHROW
void copy(message_t const *msg_)
std::string to_string() const
void * data() ZMQ_NOTHROW
GLsizei const GLchar *const * string
GLboolean GLboolean GLboolean b
void swap(Json::Value &a, Json::Value &b)
Specialize std::swap() for Json::Value.
GLenum GLuint GLenum GLsizei const GLchar * buf
TEST_CASE("message default constructed", "[message]")
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
ZMQ_NODISCARD bool empty() const ZMQ_NOTHROW
GLsizei const GLfloat * value
void move(message_t const *msg_)
size_t size() const ZMQ_NOTHROW
GLboolean GLboolean GLboolean GLboolean a
GLenum GLuint GLenum GLsizei const GLchar * message
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:56