Browse Source

test: minor changes

Michele Caini 4 năm trước cách đây
mục cha
commit
9af318a767
1 tập tin đã thay đổi với 6 bổ sung5 xóa
  1. 6 5
      test/entt/entity/entity.cpp

+ 6 - 5
test/entt/entity/entity.cpp

@@ -7,11 +7,6 @@
 TEST(Entity, Null) {
     using traits_type = entt::entt_traits<entt::entity>;
 
-    entt::registry registry{};
-    const auto entity = registry.create();
-
-    registry.emplace<int>(entity, 42);
-
     ASSERT_FALSE(entt::entity{} == entt::null);
     ASSERT_TRUE(entt::entity{traits_type::entity_mask} == entt::null);
     ASSERT_TRUE(entt::entity{~typename traits_type::entity_type{}} == entt::null);
@@ -19,6 +14,11 @@ TEST(Entity, Null) {
     ASSERT_TRUE(entt::null == entt::null);
     ASSERT_FALSE(entt::null != entt::null);
 
+    entt::registry registry{};
+    auto entity = registry.create();
+
+    registry.emplace<int>(entity, 42);
+
     ASSERT_FALSE(entity == entt::null);
     ASSERT_FALSE(entt::null == entity);
 
@@ -26,4 +26,5 @@ TEST(Entity, Null) {
     ASSERT_TRUE(entt::null != entity);
 
     ASSERT_FALSE(registry.valid(entt::null));
+    ASSERT_DEATH((entity = registry.create(entt::null)), "");
 }