mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-14 19:16:35 +02:00
Return JsonArray
and JsonObject
by value (closes #309)
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
static void check(const JsonObject& object, const char* expected_data,
|
||||
static void check(const JsonObject object, const char* expected_data,
|
||||
size_t expected_len) {
|
||||
std::string expected(expected_data, expected_data + expected_len);
|
||||
std::string actual;
|
||||
@ -17,19 +17,19 @@ static void check(const JsonObject& object, const char* expected_data,
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
static void check(const JsonObject& object, const char (&expected_data)[N]) {
|
||||
static void check(const JsonObject object, const char (&expected_data)[N]) {
|
||||
const size_t expected_len = N - 1;
|
||||
check(object, expected_data, expected_len);
|
||||
}
|
||||
|
||||
// TODO: used by the commented test
|
||||
// static void check(const JsonObject& object, const std::string& expected) {
|
||||
// static void check(const JsonObject object, const std::string& expected) {
|
||||
// check(object, expected.data(), expected.length());
|
||||
//}
|
||||
|
||||
TEST_CASE("serialize MsgPack object") {
|
||||
DynamicJsonDocument doc;
|
||||
JsonObject& object = doc.to<JsonObject>();
|
||||
JsonObject object = doc.to<JsonObject>();
|
||||
|
||||
SECTION("empty") {
|
||||
check(object, "\x80");
|
||||
|
Reference in New Issue
Block a user