1 #include <gtest/gtest.h>
2 #include <entt/entity/registry.hpp>
3
4 struct empty_type {};
5
operator ==(const empty_type & lhs,const empty_type & rhs)6 bool operator==(const empty_type &lhs, const empty_type &rhs) {
7 return &lhs == &rhs;
8 }
9
TEST(Registry,NoEto)10 TEST(Registry, NoEto) {
11 entt::registry registry;
12 const auto entity = registry.create();
13
14 registry.emplace<empty_type>(entity);
15 registry.emplace<int>(entity, 42);
16
17 ASSERT_NE(registry.view<empty_type>().raw(), nullptr);
18 ASSERT_NE(registry.try_get<empty_type>(entity), nullptr);
19 ASSERT_EQ(registry.view<empty_type>().get(entity), std::as_const(registry).view<const empty_type>().get(entity));
20
21 auto view = registry.view<empty_type, int>();
22 auto cview = std::as_const(registry).view<const empty_type, const int>();
23
24 ASSERT_EQ((std::get<0>(view.get<empty_type, int>(entity))), (std::get<0>(cview.get<const empty_type, const int>(entity))));
25 }
26