main.cpp 643 B

12345678910111213141516171819202122
  1. #include <gtest/gtest.h>
  2. #include <entt/config/config.h>
  3. #include <entt/locator/locator.hpp>
  4. #include "../../../common/value_type.h"
  5. #include "lib.h"
  6. TEST(Locator, Shared) {
  7. entt::locator<test::boxed_int>::emplace().value = 4;
  8. ASSERT_EQ(entt::locator<test::boxed_int>::value().value, 4);
  9. set_up(entt::locator<test::boxed_int>::handle());
  10. use_service(3);
  11. ASSERT_EQ(entt::locator<test::boxed_int>::value().value, 3);
  12. // service updates do not propagate across boundaries
  13. entt::locator<test::boxed_int>::emplace().value = 4;
  14. use_service(3);
  15. ASSERT_EQ(entt::locator<test::boxed_int>::value().value, 4);
  16. }