diff --git a/test/entt/entity/storage_no_instance.cpp b/test/entt/entity/storage_no_instance.cpp index ce8f0f4e20..58b08010bf 100644 --- a/test/entt/entity/storage_no_instance.cpp +++ b/test/entt/entity/storage_no_instance.cpp @@ -400,6 +400,34 @@ TYPED_TEST(StorageNoInstance, ConstIterable) { } } +TYPED_TEST(StorageNoInstance, IterableIteratorConversion) { + using value_type = typename TestFixture::type; + entt::storage pool; + + pool.emplace(entt::entity{3}); + + typename entt::storage::iterable::iterator it = pool.each().begin(); + typename entt::storage::const_iterable::iterator cit = it; + + testing::StaticAssertTypeEq>(); + testing::StaticAssertTypeEq>(); + + ASSERT_EQ(it, cit); + ASSERT_NE(++cit, it); +} + +TYPED_TEST(StorageNoInstance, IterableAlgorithmCompatibility) { + using value_type = typename TestFixture::type; + entt::storage pool; + + pool.emplace(entt::entity{3}); + + const auto iterable = pool.each(); + const auto it = std::find_if(iterable.begin(), iterable.end(), [](auto args) { return std::get<0>(args) == entt::entity{3}; }); + + ASSERT_EQ(std::get<0>(*it), entt::entity{3}); +} + TYPED_TEST(StorageNoInstance, ReverseIterable) { using value_type = typename TestFixture::type; using iterator = typename entt::storage::reverse_iterable::iterator; @@ -488,14 +516,14 @@ TYPED_TEST(StorageNoInstance, ConstReverseIterable) { } } -TYPED_TEST(StorageNoInstance, IterableIteratorConversion) { +TYPED_TEST(StorageNoInstance, ReverseIterableIteratorConversion) { using value_type = typename TestFixture::type; entt::storage pool; pool.emplace(entt::entity{3}); - typename entt::storage::iterable::iterator it = pool.each().begin(); - typename entt::storage::const_iterable::iterator cit = it; + typename entt::storage::reverse_iterable::iterator it = pool.reach().begin(); + typename entt::storage::const_reverse_iterable::iterator cit = it; testing::StaticAssertTypeEq>(); testing::StaticAssertTypeEq>(); @@ -503,3 +531,15 @@ TYPED_TEST(StorageNoInstance, IterableIteratorConversion) { ASSERT_EQ(it, cit); ASSERT_NE(++cit, it); } + +TYPED_TEST(StorageNoInstance, ReverseIterableAlgorithmCompatibility) { + using value_type = typename TestFixture::type; + entt::storage pool; + + pool.emplace(entt::entity{3}); + + const auto iterable = pool.reach(); + const auto it = std::find_if(iterable.begin(), iterable.end(), [](auto args) { return std::get<0>(args) == entt::entity{3}; }); + + ASSERT_EQ(std::get<0>(*it), entt::entity{3}); +}