Michele Caini 3 лет назад
Родитель
Сommit
dc041b7ea0

+ 0 - 1
test/entt/common/tracked_memory_resource.hpp

@@ -10,7 +10,6 @@
 #        include <cstddef>
 #        include <cstddef>
 #        include <memory_resource>
 #        include <memory_resource>
 #        include <string>
 #        include <string>
-#        include <entt/config/config.h>
 
 
 namespace test {
 namespace test {
 
 

+ 0 - 1
test/entt/core/compressed_pair.cpp

@@ -4,7 +4,6 @@
 #include <utility>
 #include <utility>
 #include <vector>
 #include <vector>
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
-#include <entt/config/config.h>
 #include <entt/core/compressed_pair.hpp>
 #include <entt/core/compressed_pair.hpp>
 
 
 struct empty_type {};
 struct empty_type {};

+ 0 - 1
test/entt/core/type_info.cpp

@@ -2,7 +2,6 @@
 #include <type_traits>
 #include <type_traits>
 #include <utility>
 #include <utility>
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
-#include <entt/config/config.h>
 #include <entt/core/type_info.hpp>
 #include <entt/core/type_info.hpp>
 #include <entt/core/type_traits.hpp>
 #include <entt/core/type_traits.hpp>
 
 

+ 26 - 21
test/entt/entity/storage.cpp

@@ -78,7 +78,7 @@ struct create_from_constructor {
 template<>
 template<>
 struct entt::component_traits<std::unordered_set<char>> {
 struct entt::component_traits<std::unordered_set<char>> {
     static constexpr auto in_place_delete = true;
     static constexpr auto in_place_delete = true;
-    static constexpr auto page_size = ENTT_PACKED_PAGE;
+    static constexpr auto page_size = 128u;
 };
 };
 
 
 bool operator==(const boxed_int &lhs, const boxed_int &rhs) {
 bool operator==(const boxed_int &lhs, const boxed_int &rhs) {
@@ -87,13 +87,14 @@ bool operator==(const boxed_int &lhs, const boxed_int &rhs) {
 
 
 TEST(Storage, Functionalities) {
 TEST(Storage, Functionalities) {
     entt::storage<int> pool;
     entt::storage<int> pool;
+    constexpr auto page_size = entt::component_traits<int>::page_size;
 
 
     ASSERT_NO_THROW([[maybe_unused]] auto alloc = pool.get_allocator());
     ASSERT_NO_THROW([[maybe_unused]] auto alloc = pool.get_allocator());
     ASSERT_EQ(pool.type(), entt::type_id<int>());
     ASSERT_EQ(pool.type(), entt::type_id<int>());
 
 
     pool.reserve(42);
     pool.reserve(42);
 
 
-    ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), page_size);
     ASSERT_TRUE(pool.empty());
     ASSERT_TRUE(pool.empty());
     ASSERT_EQ(pool.size(), 0u);
     ASSERT_EQ(pool.size(), 0u);
     ASSERT_EQ(std::as_const(pool).begin(), std::as_const(pool).end());
     ASSERT_EQ(std::as_const(pool).begin(), std::as_const(pool).end());
@@ -103,7 +104,7 @@ TEST(Storage, Functionalities) {
 
 
     pool.reserve(0);
     pool.reserve(0);
 
 
-    ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), page_size);
     ASSERT_TRUE(pool.empty());
     ASSERT_TRUE(pool.empty());
 
 
     pool.emplace(entt::entity{41}, 3);
     pool.emplace(entt::entity{41}, 3);
@@ -145,7 +146,7 @@ TEST(Storage, Functionalities) {
     ASSERT_FALSE(pool.contains(entt::entity{0}));
     ASSERT_FALSE(pool.contains(entt::entity{0}));
     ASSERT_FALSE(pool.contains(entt::entity{41}));
     ASSERT_FALSE(pool.contains(entt::entity{41}));
 
 
-    ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), page_size);
 
 
     pool.shrink_to_fit();
     pool.shrink_to_fit();
 
 
@@ -799,25 +800,26 @@ TEST(Storage, Compact) {
 
 
 TEST(Storage, ShrinkToFit) {
 TEST(Storage, ShrinkToFit) {
     entt::storage<int> pool;
     entt::storage<int> pool;
+    constexpr auto page_size = entt::component_traits<int>::page_size;
 
 
-    for(std::size_t next{}; next < ENTT_PACKED_PAGE; ++next) {
+    for(std::size_t next{}; next < page_size; ++next) {
         pool.emplace(entt::entity(next));
         pool.emplace(entt::entity(next));
     }
     }
 
 
-    pool.emplace(entt::entity{ENTT_PACKED_PAGE});
-    pool.erase(entt::entity{ENTT_PACKED_PAGE});
+    pool.emplace(entt::entity{page_size});
+    pool.erase(entt::entity{page_size});
 
 
-    ASSERT_EQ(pool.capacity(), 2 * ENTT_PACKED_PAGE);
-    ASSERT_EQ(pool.size(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), 2 * page_size);
+    ASSERT_EQ(pool.size(), page_size);
 
 
     pool.shrink_to_fit();
     pool.shrink_to_fit();
 
 
-    ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
-    ASSERT_EQ(pool.size(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), page_size);
+    ASSERT_EQ(pool.size(), page_size);
 
 
     pool.clear();
     pool.clear();
 
 
-    ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), page_size);
     ASSERT_EQ(pool.size(), 0u);
     ASSERT_EQ(pool.size(), 0u);
 
 
     pool.shrink_to_fit();
     pool.shrink_to_fit();
@@ -1526,13 +1528,14 @@ TEST(Storage, RespectUnordered) {
 TEST(Storage, CanModifyDuringIteration) {
 TEST(Storage, CanModifyDuringIteration) {
     entt::storage<int> pool;
     entt::storage<int> pool;
     auto *ptr = &pool.emplace(entt::entity{0}, 42);
     auto *ptr = &pool.emplace(entt::entity{0}, 42);
+    constexpr auto page_size = entt::component_traits<int>::page_size;
 
 
-    ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), page_size);
 
 
     const auto it = pool.cbegin();
     const auto it = pool.cbegin();
-    pool.reserve(ENTT_PACKED_PAGE + 1u);
+    pool.reserve(page_size + 1u);
 
 
-    ASSERT_EQ(pool.capacity(), 2 * ENTT_PACKED_PAGE);
+    ASSERT_EQ(pool.capacity(), 2 * page_size);
     ASSERT_EQ(&pool.get(entt::entity{0}), ptr);
     ASSERT_EQ(&pool.get(entt::entity{0}), ptr);
 
 
     // this should crash with asan enabled if we break the constraint
     // this should crash with asan enabled if we break the constraint
@@ -1667,6 +1670,8 @@ TEST(Storage, ThrowingAllocator) {
         using value_type = typename decltype(pool)::value_type;
         using value_type = typename decltype(pool)::value_type;
 
 
         typename std::decay_t<decltype(pool)>::base_type &base = pool;
         typename std::decay_t<decltype(pool)>::base_type &base = pool;
+        constexpr auto packed_page_size = entt::component_traits<typename decltype(pool)::value_type>::page_size;
+        constexpr auto sparse_page_size = entt::entt_traits<typename decltype(pool)::entity_type>::page_size;
 
 
         pool_allocator_type::trigger_on_allocate = true;
         pool_allocator_type::trigger_on_allocate = true;
 
 
@@ -1675,8 +1680,8 @@ TEST(Storage, ThrowingAllocator) {
 
 
         pool_allocator_type::trigger_after_allocate = true;
         pool_allocator_type::trigger_after_allocate = true;
 
 
-        ASSERT_THROW(pool.reserve(2 * ENTT_PACKED_PAGE), typename pool_allocator_type::exception_type);
-        ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
+        ASSERT_THROW(pool.reserve(2 * packed_page_size), typename pool_allocator_type::exception_type);
+        ASSERT_EQ(pool.capacity(), packed_page_size);
 
 
         pool.shrink_to_fit();
         pool.shrink_to_fit();
 
 
@@ -1702,21 +1707,21 @@ TEST(Storage, ThrowingAllocator) {
         ASSERT_TRUE(pool.empty());
         ASSERT_TRUE(pool.empty());
 
 
         pool.emplace(entt::entity{0}, 0);
         pool.emplace(entt::entity{0}, 0);
-        const entt::entity entities[2u]{entt::entity{1}, entt::entity{ENTT_SPARSE_PAGE}};
+        const entt::entity entities[2u]{entt::entity{1}, entt::entity{sparse_page_size}};
         test::throwing_allocator<entt::entity>::trigger_after_allocate = true;
         test::throwing_allocator<entt::entity>::trigger_after_allocate = true;
 
 
         ASSERT_THROW(pool.insert(std::begin(entities), std::end(entities), value_type{0}), test::throwing_allocator<entt::entity>::exception_type);
         ASSERT_THROW(pool.insert(std::begin(entities), std::end(entities), value_type{0}), test::throwing_allocator<entt::entity>::exception_type);
         ASSERT_TRUE(pool.contains(entt::entity{1}));
         ASSERT_TRUE(pool.contains(entt::entity{1}));
-        ASSERT_FALSE(pool.contains(entt::entity{ENTT_SPARSE_PAGE}));
+        ASSERT_FALSE(pool.contains(entt::entity{sparse_page_size}));
 
 
         pool.erase(entt::entity{1});
         pool.erase(entt::entity{1});
-        const value_type components[2u]{value_type{1}, value_type{ENTT_SPARSE_PAGE}};
+        const value_type components[2u]{value_type{1}, value_type{sparse_page_size}};
         test::throwing_allocator<entt::entity>::trigger_on_allocate = true;
         test::throwing_allocator<entt::entity>::trigger_on_allocate = true;
         pool.compact();
         pool.compact();
 
 
         ASSERT_THROW(pool.insert(std::begin(entities), std::end(entities), std::begin(components)), test::throwing_allocator<entt::entity>::exception_type);
         ASSERT_THROW(pool.insert(std::begin(entities), std::end(entities), std::begin(components)), test::throwing_allocator<entt::entity>::exception_type);
         ASSERT_TRUE(pool.contains(entt::entity{1}));
         ASSERT_TRUE(pool.contains(entt::entity{1}));
-        ASSERT_FALSE(pool.contains(entt::entity{ENTT_SPARSE_PAGE}));
+        ASSERT_FALSE(pool.contains(entt::entity{sparse_page_size}));
     };
     };
 
 
     test(entt::basic_storage<entt::entity, int, test::throwing_allocator<int>>{});
     test(entt::basic_storage<entt::entity, int, test::throwing_allocator<int>>{});

+ 0 - 1
test/example/custom_identifier.cpp

@@ -1,6 +1,5 @@
 #include <cstdint>
 #include <cstdint>
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
-#include <entt/config/config.h>
 #include <entt/entity/entity.hpp>
 #include <entt/entity/entity.hpp>
 #include <entt/entity/registry.hpp>
 #include <entt/entity/registry.hpp>