🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
827 B

  1. #define CR_HOST
  2. #include <gtest/gtest.h>
  3. #include <cr.h>
  4. #include <entt/entity/registry.hpp>
  5. #include "types.h"
  6. TEST(Lib, Registry) {
  7. entt::registry registry;
  8. for(auto i = 0; i < 3; ++i) {
  9. registry.emplace<position>(registry.create(), i, i);
  10. }
  11. cr_plugin ctx;
  12. cr_plugin_load(ctx, PLUGIN);
  13. ctx.userdata = &registry;
  14. cr_plugin_update(ctx);
  15. ASSERT_EQ(registry.storage<position>().size(), registry.storage<velocity>().size());
  16. ASSERT_EQ(registry.storage<position>().size(), registry.size());
  17. registry.view<position>().each([](auto entity, auto &position) {
  18. ASSERT_EQ(position.x, static_cast<int>(entt::to_integral(entity) + 16u));
  19. ASSERT_EQ(position.y, static_cast<int>(entt::to_integral(entity) + 16u));
  20. });
  21. registry = {};
  22. cr_plugin_close(ctx);
  23. }