2019-01-29 14:09:09 +01:00
|
|
|
// ArduinoJson - arduinojson.org
|
2021-01-25 09:14:15 +01:00
|
|
|
// Copyright Benoit Blanchon 2014-2021
|
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\"]");
|
|
|
|
}
|
|
|
|
}
|