@@ -250,6 +250,38 @@ TEST_CASE("const_buffer creation with str_buffer", "[buffer]")
250250 CHECK (std::string (static_cast <const char *>(b2.data ()), b2.size ()) == " hello" );
251251}
252252
253+ TEST_CASE (" const_buffer creation with zbuf string literal char" , " [buffer]" )
254+ {
255+ using namespace zmq ::literals;
256+ constexpr zmq::const_buffer b = " hello" _zbuf;
257+ CHECK (b.size () == 5 );
258+ CHECK (std::memcmp (b.data (), " hello" , b.size ()) == 0 );
259+ }
260+
261+ TEST_CASE (" const_buffer creation with zbuf string literal wchar_t" , " [buffer]" )
262+ {
263+ using namespace zmq ::literals;
264+ constexpr zmq::const_buffer b = L" hello" _zbuf;
265+ CHECK (b.size () == 5 * sizeof (wchar_t ));
266+ CHECK (std::memcmp (b.data (), L" hello" , b.size ()) == 0 );
267+ }
268+
269+ TEST_CASE (" const_buffer creation with zbuf string literal char16_t" , " [buffer]" )
270+ {
271+ using namespace zmq ::literals;
272+ constexpr zmq::const_buffer b = u" hello" _zbuf;
273+ CHECK (b.size () == 5 * sizeof (char16_t ));
274+ CHECK (std::memcmp (b.data (), u" hello" , b.size ()) == 0 );
275+ }
276+
277+ TEST_CASE (" const_buffer creation with zbuf string literal char32_t" , " [buffer]" )
278+ {
279+ using namespace zmq ::literals;
280+ constexpr zmq::const_buffer b = U" hello" _zbuf;
281+ CHECK (b.size () == 5 * sizeof (char32_t ));
282+ CHECK (std::memcmp (b.data (), U" hello" , b.size ()) == 0 );
283+ }
284+
253285TEST_CASE (" buffer of structs" , " [buffer]" )
254286{
255287 struct some_pod
0 commit comments