storage_utility.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <gtest/gtest.h>
  2. #include <entt/entity/storage.hpp>
  3. template<typename Type>
  4. struct StorageUtility: testing::Test {
  5. using type = Type;
  6. };
  7. using StorageUtilityTypes = ::testing::Types<int, char, double, void>;
  8. TYPED_TEST_SUITE(StorageUtility, StorageUtilityTypes, );
  9. TYPED_TEST(StorageUtility, StorageType) {
  10. using value_type = typename TestFixture::type;
  11. // just a bunch of static asserts to avoid regressions
  12. #ifdef ENTT_NO_MIXIN
  13. testing::StaticAssertTypeEq<entt::storage_type_t<value_type, entt::entity>, entt::basic_storage<value_type, entt::entity>>();
  14. testing::StaticAssertTypeEq<entt::storage_type_t<value_type>, entt::storage<value_type>>();
  15. #else
  16. testing::StaticAssertTypeEq<entt::storage_type_t<value_type, entt::entity>, entt::sigh_mixin<entt::basic_storage<value_type, entt::entity>>>();
  17. testing::StaticAssertTypeEq<entt::storage_type_t<value_type>, entt::sigh_mixin<entt::storage<value_type>>>();
  18. #endif // ENTT_NO_MIXIN
  19. }
  20. TYPED_TEST(StorageUtility, StorageFor) {
  21. using value_type = typename TestFixture::type;
  22. // just a bunch of static asserts to avoid regressions
  23. #ifdef ENTT_NO_MIXIN
  24. testing::StaticAssertTypeEq<entt::storage_for_t<const value_type, entt::entity>, const entt::basic_storage<value_type, entt::entity>>();
  25. testing::StaticAssertTypeEq<entt::storage_for_t<value_type, entt::entity>, entt::basic_storage<value_type, entt::entity>>();
  26. testing::StaticAssertTypeEq<entt::storage_for_t<const value_type>, const entt::storage<value_type>>();
  27. testing::StaticAssertTypeEq<entt::storage_for_t<value_type>, entt::storage<value_type>>();
  28. #else
  29. testing::StaticAssertTypeEq<entt::storage_for_t<const value_type, entt::entity>, const entt::sigh_mixin<entt::basic_storage<value_type, entt::entity>>>();
  30. testing::StaticAssertTypeEq<entt::storage_for_t<value_type, entt::entity>, entt::sigh_mixin<entt::basic_storage<value_type, entt::entity>>>();
  31. testing::StaticAssertTypeEq<entt::storage_for_t<const value_type>, const entt::sigh_mixin<entt::storage<value_type>>>();
  32. testing::StaticAssertTypeEq<entt::storage_for_t<value_type>, entt::sigh_mixin<entt::storage<value_type>>>();
  33. #endif
  34. }