test: use shared custom_entity type

This commit is contained in:
Michele Caini
2023-11-08 12:38:36 +01:00
parent afe942ef2e
commit 6aa4c770e6

View File

@@ -13,22 +13,19 @@
#include <entt/entity/entity.hpp>
#include <entt/entity/sparse_set.hpp>
#include "../common/config.h"
#include "../common/custom_entity.h"
#include "../common/throwing_allocator.hpp"
enum custom_entity : std::uint32_t {};
struct custom_entity_traits {
using value_type = custom_entity;
using value_type = test::custom_entity;
using entity_type = std::uint32_t;
using version_type = std::uint16_t;
static constexpr entity_type entity_mask = 0x3FFFF; // 18b
static constexpr entity_type version_mask = 0x3FFF; // 14b
};
template<>
struct entt::entt_traits<custom_entity>: entt::basic_entt_traits<custom_entity_traits> {
struct entt::entt_traits<test::custom_entity>: entt::basic_entt_traits<custom_entity_traits> {
static constexpr std::size_t page_size = ENTT_SPARSE_PAGE;
};
@@ -46,7 +43,7 @@ struct SparseSet: testing::Test {
template<typename Type>
using SparseSetDeathTest = SparseSet<Type>;
using SparseSetTypes = ::testing::Types<entt::entity, custom_entity>;
using SparseSetTypes = ::testing::Types<entt::entity, test::custom_entity>;
TYPED_TEST_SUITE(SparseSet, SparseSetTypes, );
TYPED_TEST_SUITE(SparseSetDeathTest, SparseSetTypes, );