mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 20:12:16 +02:00
JsonArray::remove() and JsonObject::remove() now release the memory of the variant
This commit is contained in:
@ -26,4 +26,23 @@ TEST_CASE("DynamicMemoryPool::size()") {
|
||||
memoryPool.clear();
|
||||
REQUIRE(0 == memoryPool.size());
|
||||
}
|
||||
|
||||
SECTION("Increases after allocSlot()") {
|
||||
memoryPool.allocSlot();
|
||||
REQUIRE(sizeof(Slot) == memoryPool.size());
|
||||
|
||||
memoryPool.allocSlot();
|
||||
REQUIRE(2 * sizeof(Slot) == memoryPool.size());
|
||||
}
|
||||
|
||||
SECTION("Decreases after freeSlot()") {
|
||||
Slot* s1 = memoryPool.allocSlot();
|
||||
Slot* s2 = memoryPool.allocSlot();
|
||||
|
||||
memoryPool.freeSlot(s1);
|
||||
REQUIRE(sizeof(Slot) == memoryPool.size());
|
||||
|
||||
memoryPool.freeSlot(s2);
|
||||
REQUIRE(0 == memoryPool.size());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user