Explorar el Código

test: increase code coverage

Michele Caini hace 3 años
padre
commit
80d55a226c
Se han modificado 1 ficheros con 12 adiciones y 2 borrados
  1. 12 2
      test/entt/entity/handle.cpp

+ 12 - 2
test/entt/entity/handle.cpp

@@ -298,6 +298,9 @@ TEST(BasicHandle, HandleStorageIterator) {
     const auto entity = registry.create();
 
     registry.emplace<int>(entity);
+    registry.emplace<double>(entity);
+    // required to test the find-first initialization step
+    registry.storage<entt::entity>().erase(entity);
 
     auto test = [](auto iterable) {
         auto end{iterable.begin()};
@@ -313,6 +316,13 @@ TEST(BasicHandle, HandleStorageIterator) {
         ASSERT_EQ(++begin, iterable.end());
     };
 
-    test(entt::handle{registry, entity}.storage());
-    test(entt::const_handle{std::as_const(registry), entity}.storage());
+    const auto handle = entt::handle{registry, entity};
+    const auto chandle = entt::const_handle{std::as_const(registry), entity};
+
+    ASSERT_FALSE(registry.valid(entity));
+    ASSERT_FALSE(handle);
+    ASSERT_FALSE(chandle);
+
+    test(handle.storage());
+    test(chandle.storage());
 }