forked from bblanchon/ArduinoJson
Remove capacity from JsonDocument
's constructor
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("serialize MsgPack to various destination types") {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
JsonObject object = doc.to<JsonObject>();
|
||||
object["hello"] = "world";
|
||||
const char* expected_result = "\x81\xA5hello\xA5world";
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("measureMsgPack()") {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
JsonObject object = doc.to<JsonObject>();
|
||||
object["hello"] = "world";
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
template <typename T>
|
||||
void check(T value, const std::string& expected) {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
doc.to<JsonVariant>().set(value);
|
||||
char buffer[256] = "";
|
||||
size_t returnValue = serializeMsgPack(doc, buffer, sizeof(buffer));
|
||||
@ -13,7 +13,7 @@ void check(T value, const std::string& expected) {
|
||||
}
|
||||
|
||||
TEST_CASE("serializeMsgPack(MemberProxy)") {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
deserializeJson(doc, "{\"hello\":42}");
|
||||
JsonObject obj = doc.as<JsonObject>();
|
||||
std::string result;
|
||||
@ -24,7 +24,7 @@ TEST_CASE("serializeMsgPack(MemberProxy)") {
|
||||
}
|
||||
|
||||
TEST_CASE("serializeMsgPack(ElementProxy)") {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
deserializeJson(doc, "[42]");
|
||||
JsonArray arr = doc.as<JsonArray>();
|
||||
std::string result;
|
||||
@ -35,7 +35,7 @@ TEST_CASE("serializeMsgPack(ElementProxy)") {
|
||||
}
|
||||
|
||||
TEST_CASE("serializeMsgPack(JsonVariantSubscript)") {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
deserializeJson(doc, "[42]");
|
||||
JsonVariant var = doc.as<JsonVariant>();
|
||||
std::string result;
|
||||
|
@ -7,8 +7,6 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
using ArduinoJson::detail::sizeofArray;
|
||||
|
||||
static void check(const JsonArray array, const char* expected_data,
|
||||
size_t expected_len) {
|
||||
std::string expected(expected_data, expected_data + expected_len);
|
||||
@ -30,7 +28,7 @@ static void check(const JsonArray array, const std::string& expected) {
|
||||
}
|
||||
|
||||
TEST_CASE("serialize MsgPack array") {
|
||||
JsonDocument doc(sizeofArray(65536));
|
||||
JsonDocument doc;
|
||||
JsonArray array = doc.to<JsonArray>();
|
||||
|
||||
SECTION("empty") {
|
||||
|
@ -28,7 +28,7 @@ static void check(const JsonObject object, const char (&expected_data)[N]) {
|
||||
//}
|
||||
|
||||
TEST_CASE("serialize MsgPack object") {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
JsonObject object = doc.to<JsonObject>();
|
||||
|
||||
SECTION("empty") {
|
||||
|
@ -8,7 +8,7 @@
|
||||
template <typename T>
|
||||
static void checkVariant(T value, const char* expected_data,
|
||||
size_t expected_len) {
|
||||
JsonDocument doc(4096);
|
||||
JsonDocument doc;
|
||||
JsonVariant variant = doc.to<JsonVariant>();
|
||||
variant.set(value);
|
||||
std::string expected(expected_data, expected_data + expected_len);
|
||||
|
Reference in New Issue
Block a user