mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-21 06:22:23 +02:00
Call shrinkToFit()
in deserializeJson()
and deserializeMsgPack()
This commit is contained in:
@ -249,13 +249,14 @@ TEST_CASE("deserialize JSON array") {
|
||||
|
||||
SECTION("Should clear the JsonArray") {
|
||||
deserializeJson(doc, "[1,2,3,4]");
|
||||
deserializeJson(doc, "[]");
|
||||
JsonArray arr = doc.as<JsonArray>();
|
||||
spy.clearLog();
|
||||
|
||||
deserializeJson(doc, "[]");
|
||||
|
||||
JsonArray arr = doc.as<JsonArray>();
|
||||
REQUIRE(arr.size() == 0);
|
||||
REQUIRE(spy.log() == AllocatorLog{
|
||||
Allocate(sizeofPool()),
|
||||
Deallocate(sizeofPool()),
|
||||
Deallocate(sizeofArray(4)),
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -312,6 +313,7 @@ TEST_CASE("deserialize JSON array under memory constraints") {
|
||||
Allocate(sizeofPool()),
|
||||
Allocate(sizeofStringBuffer()),
|
||||
Reallocate(sizeofStringBuffer(), sizeofString("1234567")),
|
||||
Reallocate(sizeofPool(), sizeofArray(1)),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user