forked from bblanchon/ArduinoJson
Add a stub for DynamicJsonDocument
This commit is contained in:
@ -15,6 +15,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
add_executable(DeprecatedTests
|
||||
DynamicJsonDocument.cpp
|
||||
StaticJsonDocument.cpp
|
||||
)
|
||||
|
||||
|
37
extras/tests/Deprecated/DynamicJsonDocument.cpp
Normal file
37
extras/tests/Deprecated/DynamicJsonDocument.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
// ArduinoJson - https://arduinojson.org
|
||||
// Copyright © 2014-2023, Benoit BLANCHON
|
||||
// MIT License
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
using ArduinoJson::detail::is_base_of;
|
||||
|
||||
TEST_CASE("DynamicJsonDocument") {
|
||||
SECTION("is a JsonDocument") {
|
||||
REQUIRE(is_base_of<JsonDocument, DynamicJsonDocument>::value == true);
|
||||
}
|
||||
|
||||
SECTION("deserialize / serialize") {
|
||||
DynamicJsonDocument doc(256);
|
||||
deserializeJson(doc, "{\"hello\":\"world\"}");
|
||||
REQUIRE(doc.as<std::string>() == "{\"hello\":\"world\"}");
|
||||
}
|
||||
|
||||
SECTION("copy") {
|
||||
DynamicJsonDocument doc(256);
|
||||
doc["hello"] = "world";
|
||||
auto copy = doc;
|
||||
REQUIRE(copy.as<std::string>() == "{\"hello\":\"world\"}");
|
||||
}
|
||||
|
||||
SECTION("capacity") {
|
||||
DynamicJsonDocument doc(256);
|
||||
REQUIRE(doc.capacity() == 256);
|
||||
}
|
||||
|
||||
SECTION("garbageCollect()") {
|
||||
DynamicJsonDocument doc(256);
|
||||
doc.garbageCollect();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user