mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Add memoryUsage() to ElementProxy and MemberProxy (fixes #1730)
				
					
				
			This commit is contained in:
		| @@ -229,6 +229,20 @@ TEST_CASE("MemberProxy::size()") { | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("MemberProxy::memoryUsage()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   MemberProxy<JsonDocument &, const char *> mp = doc["hello"]; | ||||
|  | ||||
|   SECTION("returns 0 when null") { | ||||
|     REQUIRE(mp.memoryUsage() == 0); | ||||
|   } | ||||
|  | ||||
|   SECTION("return the size for a string") { | ||||
|     mp.set(std::string("hello")); | ||||
|     REQUIRE(mp.memoryUsage() == 6); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("MemberProxy::operator[]") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   MemberProxy<JsonDocument &, const char *> mp = doc["hello"]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user