mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Add memoryUsage() to ElementProxy and MemberProxy (fixes #1730)
				
					
				
			This commit is contained in:
		| @@ -188,6 +188,21 @@ TEST_CASE("ElementProxy::size()") { | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("ElementProxy::memoryUsage()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   doc.addElement(); | ||||
|   ElementProxy<JsonDocument&> ep = doc[0]; | ||||
|  | ||||
|   SECTION("returns 0 for null") { | ||||
|     REQUIRE(ep.memoryUsage() == 0); | ||||
|   } | ||||
|  | ||||
|   SECTION("returns size for string") { | ||||
|     ep.set(std::string("hello")); | ||||
|     REQUIRE(ep.memoryUsage() == 6); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("ElementProxy::operator[]") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   ElementProxy<JsonDocument&> ep = doc[1]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user