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

@ -0,0 +1,42 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2018
// MIT License
#include <ArduinoJson.h>
#include <catch.hpp>
void testStringification(JsonError error, std::string expected) {
REQUIRE(error.c_str() == expected);
}
void testBoolification(JsonError error, bool expected) {
CHECK(error == expected);
}
#define TEST_STRINGIFICATION(symbol) \
testStringification(JsonError::symbol, #symbol)
#define TEST_BOOLIFICATION(symbol, expected) \
testBoolification(JsonError::symbol, expected)
TEST_CASE("JsonError") {
SECTION("c_str()") {
TEST_STRINGIFICATION(Ok);
TEST_STRINGIFICATION(TooDeep);
TEST_STRINGIFICATION(NoMemory);
TEST_STRINGIFICATION(InvalidInput);
}
SECTION("as boolean") {
TEST_BOOLIFICATION(Ok, false);
TEST_BOOLIFICATION(TooDeep, true);
TEST_BOOLIFICATION(NoMemory, true);
TEST_BOOLIFICATION(InvalidInput, true);
}
SECTION("ostream") {
std::stringstream s;
s << JsonError::InvalidInput;
REQUIRE(s.str() == "InvalidInput");
}
}