mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Improved coverage of MemoryPool
This commit is contained in:
		| @@ -48,14 +48,17 @@ typedef BasicJsonDocument<ArmoredAllocator> ShrinkToFitTestDocument; | |||||||
|  |  | ||||||
| void testShrinkToFit(ShrinkToFitTestDocument& doc, std::string expected_json, | void testShrinkToFit(ShrinkToFitTestDocument& doc, std::string expected_json, | ||||||
|                      size_t expected_size) { |                      size_t expected_size) { | ||||||
|   doc.shrinkToFit(); |   // test twice: shrinkToFit() should be idempotent | ||||||
|  |   for (int i = 0; i < 2; i++) { | ||||||
|  |     doc.shrinkToFit(); | ||||||
|  |  | ||||||
|   REQUIRE(doc.capacity() == expected_size); |     REQUIRE(doc.capacity() == expected_size); | ||||||
|   REQUIRE(doc.memoryUsage() == expected_size); |     REQUIRE(doc.memoryUsage() == expected_size); | ||||||
|  |  | ||||||
|   std::string json; |     std::string json; | ||||||
|   serializeJson(doc, json); |     serializeJson(doc, json); | ||||||
|   REQUIRE(json == expected_json); |     REQUIRE(json == expected_json); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| TEST_CASE("BasicJsonDocument::shrinkToFit()") { | TEST_CASE("BasicJsonDocument::shrinkToFit()") { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user