containsKey.cpp 657 B

123456789101112131415161718192021222324252627
  1. // ArduinoJson - arduinojson.org
  2. // Copyright Benoit Blanchon 2014-2019
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. using namespace ARDUINOJSON_NAMESPACE;
  7. TEST_CASE("MemberProxy::containsKey()") {
  8. DynamicJsonDocument doc(4096);
  9. MemberProxy<JsonDocument&, const char*> mp = doc["hello"];
  10. SECTION("containsKey(const char*)") {
  11. mp["key"] = "value";
  12. REQUIRE(mp.containsKey("key") == true);
  13. REQUIRE(mp.containsKey("key") == true);
  14. }
  15. SECTION("containsKey(std::string)") {
  16. mp["key"] = "value";
  17. REQUIRE(mp.containsKey(std::string("key")) == true);
  18. REQUIRE(mp.containsKey(std::string("key")) == true);
  19. }
  20. }