Make VariantSlot a union. Include next slot id in VariantData

This commit is contained in:
Benoit Blanchon
2024-08-24 19:20:39 +02:00
parent ab72bb8601
commit d3721cb122
19 changed files with 170 additions and 150 deletions
+3 -2
View File
@@ -3,6 +3,7 @@
// MIT License
#include <ArduinoJson/Memory/ResourceManager.hpp>
#include <ArduinoJson/Memory/ResourceManagerImpl.hpp>
#include <ArduinoJson/Memory/VariantPoolImpl.hpp>
#include <catch.hpp>
@@ -21,7 +22,7 @@ TEST_CASE("ResourceManager::shrinkToFit()") {
}
SECTION("only one pool") {
resources.allocSlot();
resources.allocVariant();
resources.shrinkToFit();
@@ -36,7 +37,7 @@ TEST_CASE("ResourceManager::shrinkToFit()") {
for (size_t i = 0;
i < ARDUINOJSON_POOL_CAPACITY * ARDUINOJSON_INITIAL_POOL_COUNT + 1;
i++)
resources.allocSlot();
resources.allocVariant();
REQUIRE(spyingAllocator.log() ==
AllocatorLog{
Allocate(sizeofPool()) * ARDUINOJSON_INITIAL_POOL_COUNT,