#include #include #include #include #include "types.h" ENTT_API entt::component int_type(); ENTT_API entt::component char_type(); ENTT_API void update_position(int, entt::registry &); ENTT_API 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(), 3u); ASSERT_EQ(registry.size(), 3u); 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); }); }