test: use shared custom_entity type

This commit is contained in:
Michele Caini
2023-11-08 12:38:16 +01:00
parent 9b4c920d1f
commit afe942ef2e

View File

@@ -15,6 +15,7 @@
#include <entt/entity/registry.hpp>
#include "../common/aggregate.h"
#include "../common/config.h"
#include "../common/custom_entity.h"
#include "../common/empty.h"
#include "../common/non_default_constructible.h"
#include "../common/pointer_stable.h"
@@ -73,10 +74,8 @@ private:
bool *ctx_check{};
};
enum class small_entity : std::uint32_t {};
struct small_entity_traits {
using value_type = small_entity;
struct custom_entity_traits {
using value_type = test::custom_entity;
using entity_type = uint32_t;
using version_type = uint16_t;
static constexpr entity_type entity_mask = 0xFF;
@@ -84,8 +83,7 @@ struct small_entity_traits {
};
template<>
struct entt::entt_traits<small_entity>: entt::basic_entt_traits<small_entity_traits> {
using base_type = entt::basic_entt_traits<small_entity_traits>;
struct entt::entt_traits<test::custom_entity>: entt::basic_entt_traits<custom_entity_traits> {
static constexpr auto page_size = ENTT_SPARSE_PAGE;
};
@@ -625,8 +623,8 @@ TEST(Registry, CreateDestroyReleaseCornerCase) {
}
ENTT_DEBUG_TEST(RegistryDeathTest, CreateTooManyEntities) {
entt::basic_registry<small_entity> registry;
std::vector<small_entity> entity(entt::entt_traits<small_entity>::to_entity(entt::null));
entt::basic_registry<test::custom_entity> registry;
std::vector<test::custom_entity> entity(entt::entt_traits<test::custom_entity>::to_entity(entt::null));
registry.create(entity.begin(), entity.end());
ASSERT_DEATH([[maybe_unused]] const auto entt = registry.create(), "");