|
@@ -14,20 +14,20 @@ TEST(Entity, Traits) {
|
|
|
const auto entity = registry.create();
|
|
const auto entity = registry.create();
|
|
|
const auto other = registry.create();
|
|
const auto other = registry.create();
|
|
|
|
|
|
|
|
- ASSERT_EQ(entt::to_integral(entity), traits_type::to_integral(entity));
|
|
|
|
|
|
|
+ ASSERT_EQ(entt::to_integral(entity), entt::to_integral(entity));
|
|
|
ASSERT_NE(entt::to_integral(entity), entt::to_integral<entt::entity>(entt::null));
|
|
ASSERT_NE(entt::to_integral(entity), entt::to_integral<entt::entity>(entt::null));
|
|
|
ASSERT_NE(entt::to_integral(entity), entt::to_integral(entt::entity{}));
|
|
ASSERT_NE(entt::to_integral(entity), entt::to_integral(entt::entity{}));
|
|
|
|
|
|
|
|
- ASSERT_EQ(traits_type::to_entity(entity), 0u);
|
|
|
|
|
- ASSERT_EQ(traits_type::to_version(entity), 1u);
|
|
|
|
|
- ASSERT_EQ(traits_type::to_entity(other), 1u);
|
|
|
|
|
- ASSERT_EQ(traits_type::to_version(other), 0u);
|
|
|
|
|
|
|
+ ASSERT_EQ(entt::to_entity(entity), 0u);
|
|
|
|
|
+ ASSERT_EQ(entt::to_version(entity), 1u);
|
|
|
|
|
+ ASSERT_EQ(entt::to_entity(other), 1u);
|
|
|
|
|
+ ASSERT_EQ(entt::to_version(other), 0u);
|
|
|
|
|
|
|
|
- ASSERT_EQ(traits_type::construct(traits_type::to_entity(entity), traits_type::to_version(entity)), entity);
|
|
|
|
|
- ASSERT_EQ(traits_type::construct(traits_type::to_entity(other), traits_type::to_version(other)), other);
|
|
|
|
|
- ASSERT_NE(traits_type::construct(traits_type::to_entity(entity), {}), entity);
|
|
|
|
|
|
|
+ ASSERT_EQ(traits_type::construct(entt::to_entity(entity), entt::to_version(entity)), entity);
|
|
|
|
|
+ ASSERT_EQ(traits_type::construct(entt::to_entity(other), entt::to_version(other)), other);
|
|
|
|
|
+ ASSERT_NE(traits_type::construct(entt::to_entity(entity), {}), entity);
|
|
|
|
|
|
|
|
- ASSERT_EQ(traits_type::construct(traits_type::to_entity(other), traits_type::to_version(entity)), traits_type::combine(traits_type::to_integral(other), traits_type::to_integral(entity)));
|
|
|
|
|
|
|
+ ASSERT_EQ(traits_type::construct(entt::to_entity(other), entt::to_version(entity)), traits_type::combine(entt::to_integral(other), entt::to_integral(entity)));
|
|
|
|
|
|
|
|
ASSERT_EQ(traits_type::combine(entt::tombstone, entt::null), tombstone);
|
|
ASSERT_EQ(traits_type::combine(entt::tombstone, entt::null), tombstone);
|
|
|
ASSERT_EQ(traits_type::combine(entt::null, entt::tombstone), null);
|
|
ASSERT_EQ(traits_type::combine(entt::null, entt::tombstone), null);
|
|
@@ -44,8 +44,8 @@ TEST(Entity, Null) {
|
|
|
entt::registry registry{};
|
|
entt::registry registry{};
|
|
|
const auto entity = registry.create();
|
|
const auto entity = registry.create();
|
|
|
|
|
|
|
|
- ASSERT_EQ(traits_type::combine(entt::null, traits_type::to_integral(entity)), (traits_type::construct(traits_type::to_entity(null), traits_type::to_version(entity))));
|
|
|
|
|
- ASSERT_EQ(traits_type::combine(entt::null, traits_type::to_integral(null)), null);
|
|
|
|
|
|
|
+ ASSERT_EQ(traits_type::combine(entt::null, entt::to_integral(entity)), (traits_type::construct(entt::to_entity(null), entt::to_version(entity))));
|
|
|
|
|
+ ASSERT_EQ(traits_type::combine(entt::null, entt::to_integral(null)), null);
|
|
|
ASSERT_EQ(traits_type::combine(entt::null, entt::tombstone), null);
|
|
ASSERT_EQ(traits_type::combine(entt::null, entt::tombstone), null);
|
|
|
|
|
|
|
|
registry.emplace<int>(entity, 42);
|
|
registry.emplace<int>(entity, 42);
|
|
@@ -73,8 +73,8 @@ TEST(Entity, Tombstone) {
|
|
|
entt::registry registry{};
|
|
entt::registry registry{};
|
|
|
const auto entity = registry.create();
|
|
const auto entity = registry.create();
|
|
|
|
|
|
|
|
- ASSERT_EQ(traits_type::combine(traits_type::to_integral(entity), entt::tombstone), (traits_type::construct(traits_type::to_entity(entity), traits_type::to_version(tombstone))));
|
|
|
|
|
- ASSERT_EQ(traits_type::combine(entt::tombstone, traits_type::to_integral(tombstone)), tombstone);
|
|
|
|
|
|
|
+ ASSERT_EQ(traits_type::combine(entt::to_integral(entity), entt::tombstone), (traits_type::construct(entt::to_entity(entity), entt::to_version(tombstone))));
|
|
|
|
|
+ ASSERT_EQ(traits_type::combine(entt::tombstone, entt::to_integral(tombstone)), tombstone);
|
|
|
ASSERT_EQ(traits_type::combine(entt::tombstone, entt::null), tombstone);
|
|
ASSERT_EQ(traits_type::combine(entt::tombstone, entt::null), tombstone);
|
|
|
|
|
|
|
|
registry.emplace<int>(entity, 42);
|
|
registry.emplace<int>(entity, 42);
|
|
@@ -85,8 +85,8 @@ TEST(Entity, Tombstone) {
|
|
|
ASSERT_TRUE(entity != entt::tombstone);
|
|
ASSERT_TRUE(entity != entt::tombstone);
|
|
|
ASSERT_TRUE(entt::tombstone != entity);
|
|
ASSERT_TRUE(entt::tombstone != entity);
|
|
|
|
|
|
|
|
- const auto vers = traits_type::to_version(entt::tombstone);
|
|
|
|
|
- const auto other = traits_type::construct(traits_type::to_entity(entity), vers);
|
|
|
|
|
|
|
+ constexpr auto vers = entt::to_version(tombstone);
|
|
|
|
|
+ const auto other = traits_type::construct(entt::to_entity(entity), vers);
|
|
|
|
|
|
|
|
ASSERT_FALSE(registry.valid(entt::tombstone));
|
|
ASSERT_FALSE(registry.valid(entt::tombstone));
|
|
|
ASSERT_NE(registry.destroy(entity, vers), vers);
|
|
ASSERT_NE(registry.destroy(entity, vers), vers);
|