//----------------------------------------------------------------------------- // ___ __ _ _ // / _ \__ _ _ __ ___ ___ / /(_)_ __ | | __ // / /_)/ _` | '__/ __|/ _ \/ / | | '_ \| |/ / // / ___/ (_| | | \__ \ __/ /__| | | | | < // \/ \__,_|_| |___/\___\____/_|_| |_|_|\_\ . // //----------------------------------------------------------------------------- // Author: Kurt Sassenrath // Module: msgpack // // Packer tests, byte types // // Copyright (c) 2023 Kurt Sassenrath. // // License TBD. //----------------------------------------------------------------------------- #include "test_packer.h" using namespace boost::ut; suite pack_bytes = [] { #if 0 // Byte ranges -> Binary "packer::pack>"_test = [] { expect(test_deduced>()); }; #endif "packer::pack>"_test = [] { { constexpr auto data = test::make_bytes(0x01, 0x02, 0x03, 0x04); constexpr auto expected = test::make_bytes(0xc4, 0x04, 0x01, 0x02, 0x03, 0x04); std::array payload; msgpack::packer packer(payload); expect(!!packer.pack(data)); expect(std::ranges::equal(payload, expected)); } { constexpr std::array data{}; constexpr std::array expected{ std::byte(0xc5), std::byte(0x01), std::byte(0x00)}; std::array payload; msgpack::packer packer(payload); expect(!!packer.pack(data)); expect(std::ranges::equal(payload, expected)); } { constexpr std::array data{}; constexpr std::array expected{ std::byte(0xc6), std::byte(0x00), std::byte(0x01), std::byte(0x00), std::byte(0x00)}; std::array payload; msgpack::packer packer(payload); expect(!!packer.pack(data)); expect(std::ranges::equal(payload, expected)); } }; };