Disambiguated the name get() with getElement() and getMember()

This commit is contained in:
Benoit Blanchon
2019-02-15 15:53:53 +01:00
parent 7ed92bebd3
commit e9b4c6289b
19 changed files with 172 additions and 200 deletions

View File

@ -8,7 +8,6 @@ add_executable(JsonVariantTests
compare.cpp
copy.cpp
createNested.cpp
get.cpp
is.cpp
isnull.cpp
memoryUsage.cpp

View File

@ -12,13 +12,6 @@ TEST_CASE("JsonVariant::add()") {
DynamicJsonDocument doc(4096);
JsonVariant var = doc.to<JsonVariant>();
SECTION("No argument") {
JsonVariant nested = var.add();
REQUIRE(var.is<JsonArray>() == true);
REQUIRE(nested.isNull() == true);
}
SECTION("integer") {
var.add(42);

View File

@ -1,29 +0,0 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License
#include <ArduinoJson.h>
#include <catch.hpp>
TEST_CASE("JsonVariant::get()") {
DynamicJsonDocument doc(4096);
JsonVariant var = doc.to<JsonVariant>();
SECTION("get(const char*)") {
var["value"] = 42;
REQUIRE(var.get("value") == 42);
}
SECTION("get(std::string)") {
var["value"] = 42;
REQUIRE(var.get(std::string("value")) == 42);
}
SECTION("get(int)") {
var.add().set(42);
REQUIRE(var.get(0) == 42);
}
}