Added StaticJsonDocument and DynamicJsonDocument.

Removed StaticJsonArray and DynamicJsonArray.
Removed StaticJsonObject and DynamicJsonObject.
Removed StaticJsonVariant and DynamicJsonVariant.
This commit is contained in:
Benoit Blanchon
2018-04-17 21:27:45 +02:00
parent a13b9e8bdc
commit 1feb92679d
100 changed files with 1696 additions and 1844 deletions

View File

@ -6,12 +6,13 @@
#include <catch.hpp>
TEST_CASE("JsonArray::copyTo()") {
DynamicJsonArray array;
DynamicJsonDocument doc;
SECTION("BiggerOneDimensionIntegerArray") {
char json[] = "[1,2,3]";
JsonError err = deserializeJson(array, json);
JsonError err = deserializeJson(doc, json);
REQUIRE(err == JsonError::Ok);
JsonArray& array = doc.as<JsonArray>();
int destination[4] = {0};
size_t result = array.copyTo(destination);
@ -25,8 +26,9 @@ TEST_CASE("JsonArray::copyTo()") {
SECTION("SmallerOneDimensionIntegerArray") {
char json[] = "[1,2,3]";
JsonError err = deserializeJson(array, json);
JsonError err = deserializeJson(doc, json);
REQUIRE(err == JsonError::Ok);
JsonArray& array = doc.as<JsonArray>();
int destination[2] = {0};
size_t result = array.copyTo(destination);
@ -39,8 +41,9 @@ TEST_CASE("JsonArray::copyTo()") {
SECTION("TwoOneDimensionIntegerArray") {
char json[] = "[[1,2],[3],[4]]";
JsonError err = deserializeJson(array, json);
JsonError err = deserializeJson(doc, json);
REQUIRE(err == JsonError::Ok);
JsonArray& array = doc.as<JsonArray>();
int destination[3][2] = {{0}};
array.copyTo(destination);