Rename MemoryPool to ResourceManager

This commit is contained in:
Benoit Blanchon
2023-06-17 16:10:56 +02:00
parent 2a663db3c7
commit 4871380060
36 changed files with 473 additions and 453 deletions

View File

@ -0,0 +1,32 @@
// ArduinoJson - https://arduinojson.org
// Copyright © 2014-2023, Benoit BLANCHON
// MIT License
#include <ArduinoJson/Memory/ResourceManager.hpp>
#include <ArduinoJson/Strings/StringAdapters.hpp>
#include <ArduinoJson/Variant/VariantSlot.hpp>
#include <catch.hpp>
using namespace ArduinoJson::detail;
static const size_t poolCapacity = 512;
TEST_CASE("ResourceManager::clear()") {
ResourceManager resources(poolCapacity);
SECTION("Discards allocated variants") {
new (&resources) VariantSlot();
resources.clear();
REQUIRE(resources.size() == 0);
}
SECTION("Discards allocated strings") {
resources.saveString(adaptString("123456789"));
REQUIRE(resources.size() == sizeofString(9));
resources.clear();
REQUIRE(resources.size() == 0);
}
}