Remove StaticJsonDocument

This commit is contained in:
Benoit Blanchon
2023-03-15 14:54:55 +01:00
parent 5edd435fe9
commit 17a482a9b1
66 changed files with 477 additions and 1728 deletions

View File

@ -136,7 +136,7 @@ TEST_CASE("Writer<custom_string>") {
}
TEST_CASE("serializeJson(doc, String)") {
StaticJsonDocument<1024> doc;
DynamicJsonDocument doc(1024);
doc["hello"] = "world";
::String output;

View File

@ -194,8 +194,6 @@ TEST_CASE("Polyfills/type_traits") {
JsonVariantConst>::value == true);
CHECK(is_convertible<JsonObjectConst, JsonVariantConst>::value == true);
CHECK(is_convertible<DynamicJsonDocument, JsonVariantConst>::value == true);
CHECK(is_convertible<StaticJsonDocument<10>, JsonVariantConst>::value ==
true);
}
SECTION("is_class") {

View File

@ -48,7 +48,7 @@ struct PrintableString : public Printable {
TEST_CASE("Printable") {
SECTION("Doesn't overflow") {
StaticJsonDocument<8> doc;
DynamicJsonDocument doc(8);
const char* value = "example"; // == 7 chars
doc.set(666); // to make sure we override the value
@ -75,7 +75,7 @@ TEST_CASE("Printable") {
}
SECTION("Overflows early") {
StaticJsonDocument<8> doc;
DynamicJsonDocument doc(8);
const char* value = "hello world"; // > 8 chars
doc.set(666); // to make sure we override the value
@ -100,7 +100,7 @@ TEST_CASE("Printable") {
}
SECTION("Overflows adding terminator") {
StaticJsonDocument<8> doc;
DynamicJsonDocument doc(8);
const char* value = "overflow"; // == 8 chars
doc.set(666); // to make sure we override the value
@ -133,7 +133,7 @@ TEST_CASE("Printable") {
}
SECTION("String deduplication") {
StaticJsonDocument<128> doc;
DynamicJsonDocument doc(128);
doc.add(PrintableString<PrintOneCharacterAtATime>("Hello World!"));
doc.add(PrintableString<PrintAllAtOnce>("Hello World!"));
REQUIRE(doc.size() == 2);

View File

@ -13,7 +13,7 @@ TEST_CASE("unsigned char[]") {
SECTION("deserializeJson()") {
unsigned char input[] = "{\"a\":42}";
StaticJsonDocument<JSON_OBJECT_SIZE(1)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(1));
DeserializationError err = deserializeJson(doc, input);
REQUIRE(err == DeserializationError::Ok);
@ -22,7 +22,7 @@ TEST_CASE("unsigned char[]") {
SECTION("deserializeMsgPack()") {
unsigned char input[] = "\xDE\x00\x01\xA5Hello\xA5world";
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
DeserializationError err = deserializeMsgPack(doc, input);
REQUIRE(err == DeserializationError::Ok);
@ -30,7 +30,7 @@ TEST_CASE("unsigned char[]") {
SECTION("serializeMsgPack(unsigned char[])") {
unsigned char buffer[32];
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
doc["hello"] = "world";
size_t n = serializeMsgPack(doc, buffer);
@ -41,7 +41,7 @@ TEST_CASE("unsigned char[]") {
SECTION("serializeMsgPack(unsigned char*)") {
unsigned char buffer[32];
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
doc["hello"] = "world";
size_t n = serializeMsgPack(doc, buffer, sizeof(buffer));
@ -52,7 +52,7 @@ TEST_CASE("unsigned char[]") {
SECTION("serializeJson(unsigned char[])") {
unsigned char buffer[32];
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
doc["hello"] = "world";
size_t n = serializeJson(doc, buffer);
@ -63,7 +63,7 @@ TEST_CASE("unsigned char[]") {
SECTION("serializeJson(unsigned char*)") {
unsigned char buffer[32];
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
doc["hello"] = "world";
size_t n = serializeJson(doc, buffer, sizeof(buffer));
@ -74,7 +74,7 @@ TEST_CASE("unsigned char[]") {
SECTION("serializeJsonPretty(unsigned char[])") {
unsigned char buffer[32];
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
doc["hello"] = "world";
size_t n = serializeJsonPretty(doc, buffer);
@ -84,7 +84,7 @@ TEST_CASE("unsigned char[]") {
SECTION("serializeJsonPretty(unsigned char*)") {
unsigned char buffer[32];
StaticJsonDocument<JSON_OBJECT_SIZE(2)> doc;
DynamicJsonDocument doc(JSON_OBJECT_SIZE(2));
doc["hello"] = "world";
size_t n = serializeJsonPretty(doc, buffer, sizeof(buffer));