compare.cpp 606 B

1234567891011121314151617181920212223242526
  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::operator==()") {
  8. DynamicJsonDocument doc(4096);
  9. SECTION("same values") {
  10. doc["key1"] = "value";
  11. doc["key2"] = "value";
  12. REQUIRE(doc["key1"] == doc["key2"]);
  13. REQUIRE_FALSE(doc["key1"] != doc["key2"]);
  14. }
  15. SECTION("different values") {
  16. doc["key1"] = "value1";
  17. doc["key2"] = "value2";
  18. REQUIRE_FALSE(doc["key1"] == doc["key2"]);
  19. REQUIRE(doc["key1"] != doc["key2"]);
  20. }
  21. }