mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Add ARDUINOJSON_STRING_LENGTH_SIZE
to the namespace name
This commit is contained in:
32
extras/tests/MixedConfiguration/string_length_size_4.cpp
Normal file
32
extras/tests/MixedConfiguration/string_length_size_4.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#define ARDUINOJSON_STRING_LENGTH_SIZE 4
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include <catch.hpp>
|
||||
#include <string>
|
||||
|
||||
TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 4") {
|
||||
JsonDocument doc;
|
||||
|
||||
SECTION("set() returns true if string has 65536 characters") {
|
||||
auto result = doc.set(std::string(65536, '?'));
|
||||
|
||||
REQUIRE(result == true);
|
||||
REQUIRE(doc.overflowed() == false);
|
||||
}
|
||||
|
||||
SECTION("deserializeJson() returns Ok if string has 65536 characters") {
|
||||
auto input = "\"" + std::string(65536, '?') + "\"";
|
||||
|
||||
auto err = deserializeJson(doc, input);
|
||||
|
||||
REQUIRE(err == DeserializationError::Ok);
|
||||
}
|
||||
|
||||
SECTION("deserializeMsgPack() returns Ok of string has 65536 characters") {
|
||||
auto input = "\xda\xff\xff" + std::string(65536, '?');
|
||||
|
||||
auto err = deserializeMsgPack(doc, input);
|
||||
|
||||
REQUIRE(err == DeserializationError::Ok);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user