forked from bblanchon/ArduinoJson
Remove JSON_ARRAY_SIZE()
, JSON_OBJECT_SIZE()
, and JSON_STRING_SIZE()
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
# error ARDUINOJSON_ENABLE_STRING_VIEW must be set to 1
|
||||
#endif
|
||||
|
||||
using ArduinoJson::detail::sizeofArray;
|
||||
|
||||
TEST_CASE("string_view") {
|
||||
JsonDocument doc(256);
|
||||
JsonVariant variant = doc.to<JsonVariant>();
|
||||
@ -53,16 +55,16 @@ TEST_CASE("string_view") {
|
||||
|
||||
SECTION("String deduplication") {
|
||||
doc.add(std::string_view("example one", 7));
|
||||
REQUIRE(doc.memoryUsage() == JSON_ARRAY_SIZE(1) + 8);
|
||||
REQUIRE(doc.memoryUsage() == sizeofArray(1) + 8);
|
||||
|
||||
doc.add(std::string_view("example two", 7));
|
||||
REQUIRE(doc.memoryUsage() == JSON_ARRAY_SIZE(2) + 8);
|
||||
REQUIRE(doc.memoryUsage() == sizeofArray(2) + 8);
|
||||
|
||||
doc.add(std::string_view("example\0tree", 12));
|
||||
REQUIRE(doc.memoryUsage() == JSON_ARRAY_SIZE(3) + 21);
|
||||
REQUIRE(doc.memoryUsage() == sizeofArray(3) + 21);
|
||||
|
||||
doc.add(std::string_view("example\0tree and a half", 12));
|
||||
REQUIRE(doc.memoryUsage() == JSON_ARRAY_SIZE(4) + 21);
|
||||
REQUIRE(doc.memoryUsage() == sizeofArray(4) + 21);
|
||||
}
|
||||
|
||||
SECTION("as<std::string_view>()") {
|
||||
|
Reference in New Issue
Block a user