forked from bblanchon/ArduinoJson
Merge DynamicJsonDocument
with JsonDocument
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("deserialize MsgPack array") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
SECTION("fixarray") {
|
||||
SECTION("empty") {
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("deserialize MsgPack object") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
SECTION("fixmap") {
|
||||
SECTION("empty") {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
template <typename T>
|
||||
static void checkValue(const char* input, T expected) {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
DeserializationError error = deserializeMsgPack(doc, input);
|
||||
|
||||
@ -18,7 +18,7 @@ static void checkValue(const char* input, T expected) {
|
||||
|
||||
static void checkError(size_t capacity, const char* input,
|
||||
DeserializationError expected) {
|
||||
DynamicJsonDocument doc(capacity);
|
||||
JsonDocument doc(capacity);
|
||||
|
||||
DeserializationError error = deserializeMsgPack(doc, input);
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
using namespace ArduinoJson::detail;
|
||||
|
||||
TEST_CASE("deserializeMsgPack() filter") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
DeserializationError error;
|
||||
|
||||
DynamicJsonDocument filter(200);
|
||||
JsonDocument filter(200);
|
||||
DeserializationOption::Filter filterOpt(filter);
|
||||
|
||||
SECTION("root is fixmap") {
|
||||
@ -1032,10 +1032,10 @@ TEST_CASE("deserializeMsgPack() filter") {
|
||||
TEST_CASE("Zero-copy mode") { // issue #1697
|
||||
char input[] = "\x82\xA7include\x01\xA6ignore\x02";
|
||||
|
||||
DynamicJsonDocument filter(256);
|
||||
JsonDocument filter(256);
|
||||
filter["include"] = true;
|
||||
|
||||
DynamicJsonDocument doc(256);
|
||||
JsonDocument doc(256);
|
||||
DeserializationError err =
|
||||
deserializeMsgPack(doc, input, 18, DeserializationOption::Filter(filter));
|
||||
|
||||
@ -1044,8 +1044,8 @@ TEST_CASE("Zero-copy mode") { // issue #1697
|
||||
}
|
||||
|
||||
TEST_CASE("Overloads") {
|
||||
DynamicJsonDocument doc(256);
|
||||
DynamicJsonDocument filter(256);
|
||||
JsonDocument doc(256);
|
||||
JsonDocument filter(256);
|
||||
|
||||
using namespace DeserializationOption;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
DeserializationError deserialize(const char* input, size_t len) {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
return deserializeMsgPack(doc, input, len);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "CustomReader.hpp"
|
||||
|
||||
TEST_CASE("deserializeMsgPack(const std::string&)") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
SECTION("should accept const string") {
|
||||
const std::string input("\x92\x01\x02");
|
||||
@ -48,7 +48,7 @@ TEST_CASE("deserializeMsgPack(const std::string&)") {
|
||||
}
|
||||
|
||||
TEST_CASE("deserializeMsgPack(std::istream&)") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
SECTION("should accept a zero in input") {
|
||||
std::istringstream input(std::string("\x92\x00\x02", 3));
|
||||
@ -76,7 +76,7 @@ TEST_CASE("deserializeMsgPack(VLA)") {
|
||||
char vla[i];
|
||||
memcpy(vla, "\xDE\x00\x01\xA5Hello\xA5world", 15);
|
||||
|
||||
DynamicJsonDocument doc(JSON_OBJECT_SIZE(1));
|
||||
JsonDocument doc(JSON_OBJECT_SIZE(1));
|
||||
DeserializationError err = deserializeMsgPack(doc, vla);
|
||||
|
||||
REQUIRE(err == DeserializationError::Ok);
|
||||
@ -84,7 +84,7 @@ TEST_CASE("deserializeMsgPack(VLA)") {
|
||||
#endif
|
||||
|
||||
TEST_CASE("deserializeMsgPack(CustomReader)") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
CustomReader reader("\x92\xA5Hello\xA5world");
|
||||
DeserializationError err = deserializeMsgPack(doc, reader);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <sstream>
|
||||
|
||||
TEST_CASE("deserializeMsgPack() returns EmptyInput") {
|
||||
DynamicJsonDocument doc(100);
|
||||
JsonDocument doc(100);
|
||||
|
||||
SECTION("from sized buffer") {
|
||||
DeserializationError err = deserializeMsgPack(doc, "", 0);
|
||||
|
@ -12,7 +12,7 @@
|
||||
REQUIRE(DeserializationError::TooDeep == expression);
|
||||
|
||||
TEST_CASE("JsonDeserializer nesting") {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
SECTION("Input = const char*") {
|
||||
SECTION("limit = 0") {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
static void checkMsgPackDocument(const char* input, size_t inputSize,
|
||||
const char* expectedJson) {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
DeserializationError error = deserializeMsgPack(doc, input, inputSize);
|
||||
|
||||
@ -19,7 +19,7 @@ static void checkMsgPackDocument(const char* input, size_t inputSize,
|
||||
|
||||
static void checkMsgPackError(const char* input, size_t inputSize,
|
||||
DeserializationError expectedError) {
|
||||
DynamicJsonDocument doc(4096);
|
||||
JsonDocument doc(4096);
|
||||
|
||||
DeserializationError error = deserializeMsgPack(doc, input, inputSize);
|
||||
|
||||
|
Reference in New Issue
Block a user