test: minor changes
This commit is contained in:
@@ -33,6 +33,8 @@ public:
|
||||
using string_type = std::pmr::string;
|
||||
using size_type = std::size_t;
|
||||
|
||||
static constexpr const char *default_value = "a string long enough to force an allocation (hopefully)";
|
||||
|
||||
size_type do_allocate_counter() const ENTT_NOEXCEPT {
|
||||
return alloc_counter;
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ TEST(Memory, UsesAllocatorConstruction) {
|
||||
|
||||
test::tracked_memory_resource memory_resource{};
|
||||
std::pmr::polymorphic_allocator<string_type> allocator{&memory_resource};
|
||||
const char *str = "a string long enough to force an allocation (hopefully)";
|
||||
|
||||
std::unique_ptr<string_type, entt::allocation_deleter<std::pmr::polymorphic_allocator<string_type>>> ptr = entt::allocate_unique<string_type>(allocator, str);
|
||||
using type = std::unique_ptr<string_type, entt::allocation_deleter<std::pmr::polymorphic_allocator<string_type>>>;
|
||||
type ptr = entt::allocate_unique<string_type>(allocator, test::tracked_memory_resource::default_value);
|
||||
|
||||
ASSERT_GT(memory_resource.do_allocate_counter(), 1u);
|
||||
ASSERT_EQ(memory_resource.do_deallocate_counter(), 0u);
|
||||
|
||||
@@ -1765,13 +1765,12 @@ TEST(Storage, UsesAllocatorConstruction) {
|
||||
|
||||
test::tracked_memory_resource memory_resource{};
|
||||
entt::basic_storage<entt::entity, string_type, std::pmr::polymorphic_allocator<string_type>> pool{&memory_resource};
|
||||
const char *str = "a string long enough to force an allocation (hopefully)";
|
||||
const entt::entity entity{};
|
||||
|
||||
pool.emplace(entity);
|
||||
pool.erase(entity);
|
||||
memory_resource.reset();
|
||||
pool.emplace(entity, str);
|
||||
pool.emplace(entity, test::tracked_memory_resource::default_value);
|
||||
|
||||
ASSERT_GT(memory_resource.do_allocate_counter(), 0u);
|
||||
ASSERT_EQ(memory_resource.do_deallocate_counter(), 0u);
|
||||
|
||||
Reference in New Issue
Block a user