JsonArray::remove() and JsonObject::remove() now release the memory of the variant

This commit is contained in:
Benoit Blanchon
2018-10-19 19:40:21 +02:00
parent ae089dcff7
commit d8d939660b
15 changed files with 174 additions and 37 deletions

View File

@ -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());
}
}