#include #include #include #include "types.h" extern typename entt::component int_type(); extern typename entt::component char_type(); extern void update_position(int, entt::registry &); extern void assign_velocity(int, entt::registry &); TEST(Lib, Types) { entt::registry registry; ASSERT_EQ(registry.type(), registry.type()); ASSERT_EQ(registry.type(), registry.type()); ASSERT_EQ(registry.type(), int_type()); ASSERT_EQ(registry.type(), char_type()); ASSERT_EQ(registry.type(), char_type()); ASSERT_EQ(registry.type(), int_type()); } TEST(Lib, Registry) { entt::registry registry; for(auto i = 0; i < 3; ++i) { const auto entity = registry.create(); registry.assign(entity, i, i+1); } assign_velocity(2, registry); ASSERT_EQ(registry.size(), entt::registry::size_type{3}); ASSERT_EQ(registry.size(), entt::registry::size_type{3}); update_position(1, registry); registry.view().each([](auto entity, auto &position) { ASSERT_EQ(position.x, entt::to_integer(entity) + 2); ASSERT_EQ(position.y, entt::to_integer(entity) + 3); }); }