mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 08:48:30 +01:00
containsKey()
This commit is contained in:
@@ -12,19 +12,28 @@ TEST_CASE("JsonVariant::containsKey()") {
|
|||||||
DynamicJsonDocument doc(4096);
|
DynamicJsonDocument doc(4096);
|
||||||
JsonVariant var = doc.to<JsonVariant>();
|
JsonVariant var = doc.to<JsonVariant>();
|
||||||
|
|
||||||
SECTION("containsKey(const char*) returns true") {
|
SECTION("containsKey(const char*)") {
|
||||||
var["hello"] = "world";
|
var["hello"] = "world";
|
||||||
|
|
||||||
REQUIRE(var.containsKey("hello") == true);
|
REQUIRE(var.containsKey("hello") == true);
|
||||||
REQUIRE(var.containsKey("world") == false);
|
REQUIRE(var.containsKey("world") == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("containsKey(std::string) returns true") {
|
SECTION("containsKey(std::string)") {
|
||||||
var["hello"] = "world";
|
var["hello"] = "world";
|
||||||
|
|
||||||
REQUIRE(var.containsKey(std::string("hello")) == true);
|
REQUIRE(var.containsKey(std::string("hello")) == true);
|
||||||
REQUIRE(var.containsKey(std::string("world")) == false);
|
REQUIRE(var.containsKey(std::string("world")) == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("linked object") {
|
||||||
|
StaticJsonDocument<128> doc2;
|
||||||
|
doc2["hello"] = "world";
|
||||||
|
var.link(doc2);
|
||||||
|
|
||||||
|
CHECK(var.containsKey("hello") == true);
|
||||||
|
CHECK(var.containsKey("world") == false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("JsonVariantConst::containsKey()") {
|
TEST_CASE("JsonVariantConst::containsKey()") {
|
||||||
|
|||||||
Reference in New Issue
Block a user