2021-03-29 17:14:01 +02:00
|
|
|
// ArduinoJson - https://arduinojson.org
|
2023-02-16 11:45:01 +01:00
|
|
|
// Copyright © 2014-2023, Benoit BLANCHON
|
2019-01-29 14:09:09 +01:00
|
|
|
// MIT License
|
|
|
|
|
|
|
|
#include <ArduinoJson.h>
|
|
|
|
#include <catch.hpp>
|
|
|
|
|
|
|
|
TEST_CASE("JsonDocument::add()") {
|
|
|
|
DynamicJsonDocument doc(4096);
|
|
|
|
|
|
|
|
SECTION("integer") {
|
|
|
|
doc.add(42);
|
|
|
|
|
|
|
|
REQUIRE(doc.as<std::string>() == "[42]");
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("const char*") {
|
|
|
|
doc.add("hello");
|
|
|
|
|
|
|
|
REQUIRE(doc.as<std::string>() == "[\"hello\"]");
|
|
|
|
}
|
|
|
|
}
|