mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Fix comparisons operators with const JsonDocument&
				
					
				
			This commit is contained in:
		| @@ -75,3 +75,29 @@ TEST_CASE("StaticJsonDocument::operator==(const DynamicJsonDocument&)") { | ||||
|     REQUIRE(doc1 != doc2); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("JsonDocument::operator==(const JsonDocument&)") { | ||||
|   StaticJsonDocument<256> doc1; | ||||
|   StaticJsonDocument<256> doc2; | ||||
|   const JsonDocument& ref1 = doc1; | ||||
|   const JsonDocument& ref2 = doc2; | ||||
|  | ||||
|   SECTION("Empty") { | ||||
|     REQUIRE(ref1 == ref2); | ||||
|     REQUIRE_FALSE(ref1 != ref2); | ||||
|   } | ||||
|  | ||||
|   SECTION("With same object") { | ||||
|     doc1["hello"] = "world"; | ||||
|     doc2["hello"] = "world"; | ||||
|     REQUIRE(ref1 == ref2); | ||||
|     REQUIRE_FALSE(ref1 != ref2); | ||||
|   } | ||||
|  | ||||
|   SECTION("With different object") { | ||||
|     doc1["hello"] = "world"; | ||||
|     doc2["world"] = "hello"; | ||||
|     REQUIRE_FALSE(ref1 == ref2); | ||||
|     REQUIRE(ref1 != ref2); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user