Rename SlotWithId::slot() and VariantWithId::data() to ptr()

This commit is contained in:
Benoit Blanchon
2024-08-25 14:54:45 +02:00
parent 4327f72140
commit 2be24eded8
9 changed files with 28 additions and 28 deletions
@@ -14,11 +14,11 @@ TEST_CASE("ResourceManager::allocVariant()") {
ResourceManager resources;
auto s1 = resources.allocVariant();
REQUIRE(s1.data() != nullptr);
REQUIRE(s1.ptr() != nullptr);
auto s2 = resources.allocVariant();
REQUIRE(s2.data() != nullptr);
REQUIRE(s2.ptr() != nullptr);
REQUIRE(s1.data() != s2.data());
REQUIRE(s1.ptr() != s2.ptr());
}
SECTION("Returns the same slot after calling freeVariant()") {
@@ -42,8 +42,8 @@ TEST_CASE("ResourceManager::allocVariant()") {
SECTION("Returns aligned pointers") {
ResourceManager resources;
REQUIRE(isAligned(resources.allocVariant().data()));
REQUIRE(isAligned(resources.allocVariant().data()));
REQUIRE(isAligned(resources.allocVariant().ptr()));
REQUIRE(isAligned(resources.allocVariant().ptr()));
}
SECTION("Returns null if pool list allocation fails") {
@@ -51,7 +51,7 @@ TEST_CASE("ResourceManager::allocVariant()") {
auto variant = resources.allocVariant();
REQUIRE(variant.id() == NULL_SLOT);
REQUIRE(variant.data() == nullptr);
REQUIRE(variant.ptr() == nullptr);
}
SECTION("Returns null if pool allocation fails") {
@@ -61,7 +61,7 @@ TEST_CASE("ResourceManager::allocVariant()") {
auto variant = resources.allocVariant();
REQUIRE(variant.id() == NULL_SLOT);
REQUIRE(variant.data() == nullptr);
REQUIRE(variant.ptr() == nullptr);
}
SECTION("Try overflow pool counter") {
@@ -75,7 +75,7 @@ TEST_CASE("ResourceManager::allocVariant()") {
for (SlotId i = 0; i < NULL_SLOT; i++) {
auto slot = resources.allocVariant();
REQUIRE(slot.id() == i); // or != NULL_SLOT
REQUIRE(slot.data() != nullptr);
REQUIRE(slot.ptr() != nullptr);
}
REQUIRE(resources.overflowed() == false);
@@ -84,7 +84,7 @@ TEST_CASE("ResourceManager::allocVariant()") {
for (int i = 0; i < 10; i++) {
auto slot = resources.allocVariant();
REQUIRE(slot.id() == NULL_SLOT);
REQUIRE(slot.data() == nullptr);
REQUIRE(slot.ptr() == nullptr);
}
REQUIRE(resources.overflowed() == true);
+8 -8
View File
@@ -29,8 +29,8 @@ TEST_CASE("ResourceManager::swap()") {
swap(a, b);
REQUIRE(a1.data() == b.getVariant(a1.id()));
REQUIRE(b1.data() == a.getVariant(b1.id()));
REQUIRE(a1.ptr() == b.getVariant(a1.id()));
REQUIRE(b1.ptr() == a.getVariant(b1.id()));
REQUIRE(spy.log() == AllocatorLog{
Allocate(sizeofPool()) * 2,
@@ -47,8 +47,8 @@ TEST_CASE("ResourceManager::swap()") {
auto b1 = b.allocVariant();
swap(a, b);
REQUIRE(a1.data() == b.getVariant(a1.id()));
REQUIRE(b1.data() == a.getVariant(b1.id()));
REQUIRE(a1.ptr() == b.getVariant(a1.id()));
REQUIRE(b1.ptr() == a.getVariant(b1.id()));
REQUIRE(spy.log() ==
AllocatorLog{
@@ -68,8 +68,8 @@ TEST_CASE("ResourceManager::swap()") {
auto b1 = b.allocVariant();
swap(a, b);
REQUIRE(a1.data() == b.getVariant(a1.id()));
REQUIRE(b1.data() == a.getVariant(b1.id()));
REQUIRE(a1.ptr() == b.getVariant(a1.id()));
REQUIRE(b1.ptr() == a.getVariant(b1.id()));
REQUIRE(spy.log() ==
AllocatorLog{
@@ -91,7 +91,7 @@ TEST_CASE("ResourceManager::swap()") {
swap(a, b);
REQUIRE(a1.data() == b.getVariant(a1.id()));
REQUIRE(b1.data() == a.getVariant(b1.id()));
REQUIRE(a1.ptr() == b.getVariant(a1.id()));
REQUIRE(b1.ptr() == a.getVariant(b1.id()));
}
}