forked from bblanchon/ArduinoJson
Remove StaticJsonDocument
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
// Here, we're just filling the holes
|
||||
|
||||
TEST_CASE("Compare JsonVariant with value") {
|
||||
StaticJsonDocument<256> doc;
|
||||
DynamicJsonDocument doc(256);
|
||||
JsonVariant a = doc.add();
|
||||
|
||||
SECTION("null vs (char*)0") {
|
||||
@ -37,7 +37,7 @@ TEST_CASE("Compare JsonVariant with value") {
|
||||
}
|
||||
|
||||
TEST_CASE("Compare JsonVariant with JsonVariant") {
|
||||
StaticJsonDocument<256> doc;
|
||||
DynamicJsonDocument doc(256);
|
||||
JsonVariant a = doc.add();
|
||||
JsonVariant b = doc.add();
|
||||
|
||||
|
@ -71,13 +71,13 @@ TEST_CASE("JsonVariant::isNull()") {
|
||||
}
|
||||
|
||||
SECTION("returns true for a shallow null copy") {
|
||||
StaticJsonDocument<128> doc2;
|
||||
DynamicJsonDocument doc2(128);
|
||||
variant.shallowCopy(doc2);
|
||||
CHECK(variant.isNull() == true);
|
||||
}
|
||||
|
||||
SECTION("returns false for a shallow array copy") {
|
||||
StaticJsonDocument<128> doc2;
|
||||
DynamicJsonDocument doc2(128);
|
||||
doc2[0] = 42;
|
||||
variant.shallowCopy(doc2);
|
||||
CHECK(variant.isNull() == false);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
template <typename TOut, typename TIn>
|
||||
void shouldBeOk(TIn value) {
|
||||
StaticJsonDocument<1> doc;
|
||||
DynamicJsonDocument doc(1);
|
||||
JsonVariant var = doc.to<JsonVariant>();
|
||||
var.set(value);
|
||||
REQUIRE(var.as<TOut>() == TOut(value));
|
||||
@ -15,7 +15,7 @@ void shouldBeOk(TIn value) {
|
||||
|
||||
template <typename TOut, typename TIn>
|
||||
void shouldOverflow(TIn value) {
|
||||
StaticJsonDocument<1> doc;
|
||||
DynamicJsonDocument doc(1);
|
||||
JsonVariant var = doc.to<JsonVariant>();
|
||||
var.set(value);
|
||||
REQUIRE(var.as<TOut>() == 0);
|
||||
|
@ -128,7 +128,7 @@ TEST_CASE("JsonVariant::set() when there is enough memory") {
|
||||
}
|
||||
|
||||
TEST_CASE("JsonVariant::set() with not enough memory") {
|
||||
StaticJsonDocument<1> doc;
|
||||
DynamicJsonDocument doc(1);
|
||||
|
||||
JsonVariant v = doc.to<JsonVariant>();
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("JsonVariant::shallowCopy()") {
|
||||
StaticJsonDocument<1024> doc1, doc2;
|
||||
DynamicJsonDocument doc1(1024), doc2(1024);
|
||||
JsonVariant variant = doc1.to<JsonVariant>();
|
||||
|
||||
SECTION("JsonVariant::shallowCopy(JsonDocument&)") {
|
||||
|
@ -69,13 +69,13 @@ TEST_CASE("vector<int>") {
|
||||
SECTION("toJson") {
|
||||
std::vector<int> v = {1, 2};
|
||||
|
||||
StaticJsonDocument<128> doc;
|
||||
DynamicJsonDocument doc(128);
|
||||
doc.set(v);
|
||||
REQUIRE(doc.as<std::string>() == "[1,2]");
|
||||
}
|
||||
|
||||
SECTION("fromJson") {
|
||||
StaticJsonDocument<128> doc;
|
||||
DynamicJsonDocument doc(128);
|
||||
doc.add(1);
|
||||
doc.add(2);
|
||||
|
||||
@ -86,7 +86,7 @@ TEST_CASE("vector<int>") {
|
||||
}
|
||||
|
||||
SECTION("checkJson") {
|
||||
StaticJsonDocument<128> doc;
|
||||
DynamicJsonDocument doc(128);
|
||||
CHECK(doc.is<std::vector<int>>() == false);
|
||||
|
||||
doc.add(1);
|
||||
@ -106,13 +106,13 @@ TEST_CASE("array<int, 2>") {
|
||||
v[0] = 1;
|
||||
v[1] = 2;
|
||||
|
||||
StaticJsonDocument<128> doc;
|
||||
DynamicJsonDocument doc(128);
|
||||
doc.set(v);
|
||||
REQUIRE(doc.as<std::string>() == "[1,2]");
|
||||
}
|
||||
|
||||
SECTION("fromJson") {
|
||||
StaticJsonDocument<128> doc;
|
||||
DynamicJsonDocument doc(128);
|
||||
doc.add(1);
|
||||
doc.add(2);
|
||||
|
||||
@ -123,7 +123,7 @@ TEST_CASE("array<int, 2>") {
|
||||
}
|
||||
|
||||
SECTION("checkJson") {
|
||||
StaticJsonDocument<128> doc;
|
||||
DynamicJsonDocument doc(128);
|
||||
CHECK(doc.is<array_type>() == false);
|
||||
|
||||
doc.add(1);
|
||||
|
Reference in New Issue
Block a user