null entity
This commit is contained in:
@@ -53,6 +53,7 @@ ADD_ENTT_TEST(ident entt/core/ident.cpp)
|
||||
# Test entity
|
||||
|
||||
ADD_ENTT_TEST(actor entt/entity/actor.cpp)
|
||||
ADD_ENTT_TEST(entity entt/entity/entity.cpp)
|
||||
ADD_ENTT_TEST(helper entt/entity/helper.cpp)
|
||||
ADD_ENTT_TEST(prototype entt/entity/prototype.cpp)
|
||||
ADD_ENTT_TEST(registry entt/entity/registry.cpp)
|
||||
|
||||
27
test/entt/entity/entity.cpp
Normal file
27
test/entt/entity/entity.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <functional>
|
||||
#include <gtest/gtest.h>
|
||||
#include <entt/entity/entity.hpp>
|
||||
#include <entt/entity/registry.hpp>
|
||||
|
||||
template<bool>
|
||||
struct S {};
|
||||
|
||||
TEST(Traits, Null) {
|
||||
entt::DefaultRegistry registry{};
|
||||
|
||||
const auto entity = registry.create();
|
||||
registry.assign<int>(entity, 42);
|
||||
|
||||
ASSERT_TRUE(~typename entt::DefaultRegistry::entity_type{} == entt::null);
|
||||
|
||||
ASSERT_TRUE(entt::null == entt::null);
|
||||
ASSERT_FALSE(entt::null != entt::null);
|
||||
|
||||
ASSERT_FALSE(entity == entt::null);
|
||||
ASSERT_FALSE(entt::null == entity);
|
||||
|
||||
ASSERT_TRUE(entity != entt::null);
|
||||
ASSERT_TRUE(entt::null != entity);
|
||||
|
||||
ASSERT_FALSE(registry.valid(entt::null));
|
||||
}
|
||||
Reference in New Issue
Block a user