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

@ -18,8 +18,7 @@ std::stringstream allocatorLog;
struct SpyingAllocator : DefaultAllocator {
void* allocate(size_t n) {
allocatorLog << static_cast<const char*>("A")
<< (n - DynamicJsonBuffer::EmptyBlockSize);
allocatorLog << "A" << (n - DynamicJsonBuffer::EmptyBlockSize);
return DefaultAllocator::allocate(n);
}
void deallocate(void* p) {

View File

@ -23,19 +23,9 @@ TEST_CASE("DynamicJsonBuffer no memory") {
}
// TODO: uncomment
// SECTION("parseArray()") {
// char json[] = "[{}]";
// DynamicJsonArray arr;
// JsonError err = deserializeJson(arr, json);
// REQUIRE(err != JsonError::Ok);
// }
// TODO: uncomment
// SECTION("parseObject()") {
// SECTION("deserializeJson()") {
// char json[] = "{[]}";
// DynamicJsonObject obj;
// DynamicJsonDocument obj;
// JsonError err = deserializeJson(obj, json);

View File

@ -2,9 +2,11 @@
// Copyright Benoit Blanchon 2014-2018
// MIT License
#include <ArduinoJson.h>
#include <ArduinoJson/Memory/DynamicJsonBuffer.hpp>
#include <catch.hpp>
using namespace ArduinoJson::Internals;
TEST_CASE("DynamicJsonBuffer::size()") {
DynamicJsonBuffer buffer;

View File

@ -2,9 +2,11 @@
// Copyright Benoit Blanchon 2014-2018
// MIT License
#include <ArduinoJson.h>
#include <ArduinoJson/Memory/DynamicJsonBuffer.hpp>
#include <catch.hpp>
using namespace ArduinoJson::Internals;
TEST_CASE("DynamicJsonBuffer::startString()") {
SECTION("WorksWhenBufferIsBigEnough") {
DynamicJsonBuffer jsonBuffer(6);