ソースを参照

test: minor changes

Michele Caini 4 年 前
コミット
d093df02ac
2 ファイル変更11 行追加7 行削除
  1. 8 4
      test/entt/entity/entity.cpp
  2. 3 3
      test/example/custom_identifier.cpp

+ 8 - 4
test/entt/entity/entity.cpp

@@ -35,6 +35,8 @@ TEST(Entity, Traits) {
 
 TEST(Entity, Null) {
     using traits_type = entt::entt_traits<entt::entity>;
+    constexpr entt::entity tombstone = entt::tombstone;
+    constexpr entt::entity null = entt::null;
 
     ASSERT_FALSE(entt::entity{} == entt::null);
     ASSERT_TRUE(entt::entity{traits_type::reserved()} == entt::null);
@@ -46,8 +48,8 @@ TEST(Entity, Null) {
     const auto entity = registry.create();
 
     ASSERT_EQ((entt::null | entity), (traits_type::to_type(entt::null, entity)));
-    ASSERT_EQ((entt::null | static_cast<entt::entity>(entt::null)), static_cast<entt::entity>(entt::null));
-    ASSERT_EQ((entt::null | static_cast<entt::entity>(entt::tombstone)), static_cast<entt::entity>(entt::null));
+    ASSERT_EQ((entt::null | null), null);
+    ASSERT_EQ((entt::null | tombstone), null);
 
     registry.emplace<int>(entity, 42);
 
@@ -65,6 +67,8 @@ TEST(Entity, Null) {
 
 TEST(Entity, Tombstone) {
     using traits_type = entt::entt_traits<entt::entity>;
+    constexpr entt::entity tombstone = entt::tombstone;
+    constexpr entt::entity null = entt::null;
 
     ASSERT_FALSE(entt::entity{} == entt::tombstone);
     ASSERT_TRUE(entt::entity{traits_type::reserved()} == entt::tombstone);
@@ -76,8 +80,8 @@ TEST(Entity, Tombstone) {
     const auto entity = registry.create();
 
     ASSERT_EQ((entt::tombstone | entity), (traits_type::to_type(entity, entt::tombstone)));
-    ASSERT_EQ((entt::tombstone | static_cast<entt::entity>(entt::tombstone)), static_cast<entt::entity>(entt::tombstone));
-    ASSERT_EQ((entt::tombstone | static_cast<entt::entity>(entt::null)), static_cast<entt::entity>(entt::tombstone));
+    ASSERT_EQ((entt::tombstone | tombstone), tombstone);
+    ASSERT_EQ((entt::tombstone | null), tombstone);
 
     registry.emplace<int>(entity, 42);
 

+ 3 - 3
test/example/custom_identifier.cpp

@@ -7,15 +7,15 @@ struct entity_id {
     using entity_type = std::uint32_t;
     static constexpr auto null = entt::null;
 
-    constexpr entity_id(entity_type value = null)
+    constexpr entity_id(entity_type value = null) ENTT_NOEXCEPT
         : entt{value}
     {}
 
-    constexpr entity_id(const entity_id &other)
+    constexpr entity_id(const entity_id &other) ENTT_NOEXCEPT
         : entt{other.entt}
     {}
 
-    constexpr operator entity_type() const {
+    constexpr operator entity_type() const ENTT_NOEXCEPT {
         return entt;
     }