mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 04:22:18 +02:00
Implement MsgPackBinary using raw strings and converters
This commit is contained in:
@ -21,16 +21,16 @@ TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 2") {
|
||||
REQUIRE(doc.overflowed() == true);
|
||||
}
|
||||
|
||||
SECTION("set() returns true if string has 65535 characters") {
|
||||
auto str = std::string(65535, '?');
|
||||
SECTION("set() returns true if string has 65532 characters") {
|
||||
auto str = std::string(65532, '?');
|
||||
auto result = doc.set(MsgPackBinary(str.data(), str.size()));
|
||||
|
||||
REQUIRE(result == true);
|
||||
REQUIRE(doc.overflowed() == false);
|
||||
}
|
||||
|
||||
SECTION("set() returns false if string has 65536 characters") {
|
||||
auto str = std::string(65536, '?');
|
||||
SECTION("set() returns false if string has 65533 characters") {
|
||||
auto str = std::string(65533, '?');
|
||||
auto result = doc.set(MsgPackBinary(str.data(), str.size()));
|
||||
|
||||
REQUIRE(result == false);
|
||||
@ -71,8 +71,8 @@ TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 2") {
|
||||
REQUIRE(err == DeserializationError::NoMemory);
|
||||
}
|
||||
|
||||
SECTION("deserializeMsgPack() returns Ok if binary has 65535 characters") {
|
||||
auto input = "\xc5\xff\xff" + std::string(65535, '?');
|
||||
SECTION("deserializeMsgPack() returns Ok if binary has 65532 characters") {
|
||||
auto input = "\xc5\xff\xfc" + std::string(65532, '?');
|
||||
|
||||
auto err = deserializeMsgPack(doc, input);
|
||||
|
||||
@ -80,9 +80,8 @@ TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 2") {
|
||||
}
|
||||
|
||||
SECTION(
|
||||
"deserializeMsgPack() returns NoMemory of binary has 65536 characters") {
|
||||
auto input =
|
||||
std::string("\xc6\x00\x01\x00\x00", 5) + std::string(65536, '?');
|
||||
"deserializeMsgPack() returns NoMemory of binary has 65534 characters") {
|
||||
auto input = "\xc5\xff\xfd" + std::string(65534, '?');
|
||||
|
||||
auto err = deserializeMsgPack(doc, input);
|
||||
|
||||
|
Reference in New Issue
Block a user