forked from bblanchon/ArduinoJson
Merge DynamicJsonDocument
with JsonDocument
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("deserialize JSON object") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
SECTION("An empty object") {
|
||||
DeserializationError err = deserializeJson(doc, "{}");
|
||||
@ -316,7 +316,7 @@ TEST_CASE("deserialize JSON object") {
|
||||
|
||||
TEST_CASE("deserialize JSON object under memory constraints") {
|
||||
SECTION("buffer for the right size for an empty object") {
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(0));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(0));
|
||||
char input[] = "{}";
|
||||
|
||||
DeserializationError err = deserializeJson(doc, input);
|
||||
@ -325,7 +325,7 @@ TEST_CASE("deserialize JSON object under memory constraints") {
|
||||
}
|
||||
|
||||
SECTION("buffer too small for an empty object") {
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(0));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(0));
|
||||
char input[] = "{\"a\":1}";
|
||||
|
||||
DeserializationError err = deserializeJson(doc, input);
|
||||
@ -334,7 +334,7 @@ TEST_CASE("deserialize JSON object under memory constraints") {
|
||||
}
|
||||
|
||||
SECTION("buffer of the right size for an object with one member") {
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(1));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(1));
|
||||
char input[] = "{\"a\":1}";
|
||||
|
||||
DeserializationError err = deserializeJson(doc, input);
|
||||
@ -343,7 +343,7 @@ TEST_CASE("deserialize JSON object under memory constraints") {
|
||||
}
|
||||
|
||||
SECTION("buffer too small for an object with a nested array") {
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(0) + JSON_ARRAY_SIZE(0));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(0) + JSON_ARRAY_SIZE(0));
|
||||
char input[] = "{\"a\":[]}";
|
||||
|
||||
DeserializationError err = deserializeJson(doc, input);
|
||||
@ -352,7 +352,7 @@ TEST_CASE("deserialize JSON object under memory constraints") {
|
||||
}
|
||||
|
||||
SECTION("buffer of the right size for an object with a nested array") {
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(1) + JSON_ARRAY_SIZE(0));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(1) + JSON_ARRAY_SIZE(0));
|
||||
char input[] = "{\"a\":[]}";
|
||||
|
||||
DeserializationError err = deserializeJson(doc, input);
|
||||
@ -361,7 +361,7 @@ TEST_CASE("deserialize JSON object under memory constraints") {
|
||||
}
|
||||
|
||||
SECTION("Should clear the JsonObject") {
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(1));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(1));
|
||||
char input[] = "{\"hello\":\"world\"}";
|
||||
|
||||
deserializeJson(doc, input);
|
||||
|
Reference in New Issue
Block a user