From fc7d28c72364d0d1f42c0cd19f4794c13449ca87 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 23 Jun 2022 15:46:28 +0200 Subject: [PATCH] test: view constructors --- test/entt/entity/view.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/entt/entity/view.cpp b/test/entt/entity/view.cpp index cc4155866..633178b1d 100644 --- a/test/entt/entity/view.cpp +++ b/test/entt/entity/view.cpp @@ -70,6 +70,20 @@ TEST(SingleComponentView, Functionalities) { ASSERT_FALSE(invalid); } +TEST(SingleComponentView, Constructors) { + entt::storage storage{}; + + entt::view> invalid{}; + entt::basic_view from_storage{storage}; + entt::basic_view from_tuple{std::forward_as_tuple(storage)}; + + ASSERT_FALSE(invalid); + ASSERT_TRUE(from_storage); + ASSERT_TRUE(from_tuple); + + ASSERT_EQ(&from_storage.handle(), &from_tuple.handle()); +} + TEST(SingleComponentView, Handle) { entt::registry registry; const auto entity = registry.create(); @@ -518,6 +532,20 @@ TEST(MultiComponentView, Functionalities) { ASSERT_FALSE(invalid); } +TEST(MultiComponentView, Constructors) { + entt::storage storage{}; + + entt::view> invalid{}; + entt::basic_view from_storage{storage, storage}; + entt::basic_view from_tuple{std::forward_as_tuple(storage, storage)}; + + ASSERT_FALSE(invalid); + ASSERT_TRUE(from_storage); + ASSERT_TRUE(from_tuple); + + ASSERT_EQ(&from_storage.handle(), &from_tuple.handle()); +} + TEST(MultiComponentView, Handle) { entt::registry registry; const auto entity = registry.create();