32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
//-----------------------------------------------------------------------------
|
|
// ___ __ _ _
|
|
// / _ \__ _ _ __ ___ ___ / /(_)_ __ | | __
|
|
// / /_)/ _` | '__/ __|/ _ \/ / | | '_ \| |/ /
|
|
// / ___/ (_| | | \__ \ __/ /__| | | | | <
|
|
// \/ \__,_|_| |___/\___\____/_|_| |_|_|\_\ .
|
|
//
|
|
//-----------------------------------------------------------------------------
|
|
// Author: Kurt Sassenrath
|
|
// Module: msgpack
|
|
//
|
|
// Unpacker tests for strings.
|
|
//
|
|
// Copyright (c) 2023 Kurt Sassenrath.
|
|
//
|
|
// License TBD.
|
|
//-----------------------------------------------------------------------------
|
|
#include "test_unpacker.h"
|
|
|
|
using namespace boost::ut;
|
|
|
|
suite unpack_string_types = [] {
|
|
"unpacker::unpack<std::string_view>"_test = [] {
|
|
static constexpr auto payload = test::make_bytes(0xa2, 'H', 'i');
|
|
msgpack::unpacker unpacker(payload);
|
|
expect(type_check_unpacker<std::string_view>(unpacker));
|
|
expect(unpacker.unpack<std::string_view>() == "Hi");
|
|
expect(unpacker.unpack<msgpack::invalid>()
|
|
== tl::make_unexpected(msgpack::error::end_of_message));
|
|
};
|
|
};
|