Michele Caini 2 лет назад
Родитель
Сommit
38f63135a8
3 измененных файлов с 31 добавлено и 14 удалено
  1. 1 0
      test/CMakeLists.txt
  2. 0 14
      test/entt/entity/storage.cpp
  3. 30 0
      test/entt/entity/storage_utility.cpp

+ 1 - 0
test/CMakeLists.txt

@@ -246,6 +246,7 @@ SETUP_BASIC_TEST(snapshot entt/entity/snapshot.cpp)
 SETUP_BASIC_TEST(sparse_set entt/entity/sparse_set.cpp)
 SETUP_BASIC_TEST(storage entt/entity/storage.cpp)
 SETUP_BASIC_TEST(storage_no_instance entt/entity/storage_no_instance.cpp)
+SETUP_BASIC_TEST(storage_utility entt/entity/storage_utility.cpp)
 SETUP_BASIC_TEST(view entt/entity/view.cpp)
 
 # Test graph

+ 0 - 14
test/entt/entity/storage.cpp

@@ -2129,20 +2129,6 @@ TEST_F(StorageOld, UsesAllocatorConstruction) {
 
 #endif
 
-TEST_F(StorageOld, StorageType) {
-    // just a bunch of static asserts to avoid regressions
-    testing::StaticAssertTypeEq<entt::storage_type_t<char, entt::entity>, entt::sigh_mixin<entt::basic_storage<char, entt::entity>>>();
-    testing::StaticAssertTypeEq<entt::storage_type_t<int>, entt::sigh_mixin<entt::storage<int>>>();
-}
-
-TEST_F(StorageOld, StorageFor) {
-    // just a bunch of static asserts to avoid regressions
-    testing::StaticAssertTypeEq<entt::storage_for_t<const double, entt::entity>, const entt::sigh_mixin<entt::basic_storage<double, entt::entity>>>();
-    testing::StaticAssertTypeEq<entt::storage_for_t<char, entt::entity>, entt::sigh_mixin<entt::basic_storage<char, entt::entity>>>();
-    testing::StaticAssertTypeEq<entt::storage_for_t<const bool>, const entt::sigh_mixin<entt::storage<bool>>>();
-    testing::StaticAssertTypeEq<entt::storage_for_t<int>, entt::sigh_mixin<entt::storage<int>>>();
-}
-
 TEST(StorageEntity, TypeAndPolicy) {
     entt::storage<entt::entity> pool;
 

+ 30 - 0
test/entt/entity/storage_utility.cpp

@@ -0,0 +1,30 @@
+#include <gtest/gtest.h>
+#include <entt/core/type_traits.hpp>
+#include <entt/entity/storage.hpp>
+
+template<typename Type>
+struct StorageUtility: testing::Test {
+    using type = Type;
+};
+
+using StorageUtilityTypes = ::testing::Types<int, char, double, void>;
+
+TYPED_TEST_SUITE(StorageUtility, StorageUtilityTypes, );
+
+TYPED_TEST(StorageUtility, StorageType) {
+    using value_type = typename TestFixture::type;
+
+    // just a bunch of static asserts to avoid regressions
+    testing::StaticAssertTypeEq<entt::storage_type_t<value_type, entt::entity>, entt::sigh_mixin<entt::basic_storage<value_type, entt::entity>>>();
+    testing::StaticAssertTypeEq<entt::storage_type_t<value_type>, entt::sigh_mixin<entt::storage<value_type>>>();
+}
+
+TYPED_TEST(StorageUtility, StorageFor) {
+    using value_type = typename TestFixture::type;
+
+    // just a bunch of static asserts to avoid regressions
+    testing::StaticAssertTypeEq<entt::storage_for_t<const value_type, entt::entity>, const entt::sigh_mixin<entt::basic_storage<value_type, entt::entity>>>();
+    testing::StaticAssertTypeEq<entt::storage_for_t<value_type, entt::entity>, entt::sigh_mixin<entt::basic_storage<value_type, entt::entity>>>();
+    testing::StaticAssertTypeEq<entt::storage_for_t<const value_type>, const entt::sigh_mixin<entt::storage<value_type>>>();
+    testing::StaticAssertTypeEq<entt::storage_for_t<value_type>, entt::sigh_mixin<entt::storage<value_type>>>();
+}