|
|
@@ -5,39 +5,39 @@
|
|
|
#include <entt/meta/resolve.hpp>
|
|
|
|
|
|
struct clazz_t {
|
|
|
- void incr() { ++value; }
|
|
|
- void decr() { --value; }
|
|
|
- int value;
|
|
|
+ void incr() { ++value; }
|
|
|
+ void decr() { --value; }
|
|
|
+ int value;
|
|
|
};
|
|
|
|
|
|
struct MetaHandle: ::testing::Test {
|
|
|
- static void SetUpTestCase() {
|
|
|
- using namespace entt::literals;
|
|
|
+ static void SetUpTestCase() {
|
|
|
+ using namespace entt::literals;
|
|
|
|
|
|
- entt::meta<clazz_t>()
|
|
|
- .func<&clazz_t::incr>("incr"_hs)
|
|
|
- .func<&clazz_t::decr>("decr"_hs);
|
|
|
- }
|
|
|
+ entt::meta<clazz_t>()
|
|
|
+ .func<&clazz_t::incr>("incr"_hs)
|
|
|
+ .func<&clazz_t::decr>("decr"_hs);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
TEST_F(MetaHandle, Functionalities) {
|
|
|
- using namespace entt::literals;
|
|
|
+ using namespace entt::literals;
|
|
|
|
|
|
- clazz_t instance{};
|
|
|
- entt::meta_handle handle{};
|
|
|
+ clazz_t instance{};
|
|
|
+ entt::meta_handle handle{};
|
|
|
|
|
|
- ASSERT_FALSE(*handle);
|
|
|
+ ASSERT_FALSE(*handle);
|
|
|
|
|
|
- handle = entt::meta_handle{instance};
|
|
|
+ handle = entt::meta_handle{instance};
|
|
|
|
|
|
- ASSERT_TRUE(*handle);
|
|
|
- ASSERT_TRUE((*handle).invoke("incr"_hs));
|
|
|
- ASSERT_EQ(instance.value, 1);
|
|
|
+ ASSERT_TRUE(*handle);
|
|
|
+ ASSERT_TRUE((*handle).invoke("incr"_hs));
|
|
|
+ ASSERT_EQ(instance.value, 1);
|
|
|
|
|
|
- entt::meta_any any{std::ref(instance)};
|
|
|
- handle = entt::meta_handle{any};
|
|
|
+ entt::meta_any any{std::ref(instance)};
|
|
|
+ handle = entt::meta_handle{any};
|
|
|
|
|
|
- ASSERT_FALSE(std::as_const(handle)->invoke("decr"_hs));
|
|
|
- ASSERT_TRUE(handle->invoke("decr"_hs));
|
|
|
- ASSERT_EQ(instance.value, 0);
|
|
|
+ ASSERT_FALSE(std::as_const(handle)->invoke("decr"_hs));
|
|
|
+ ASSERT_TRUE(handle->invoke("decr"_hs));
|
|
|
+ ASSERT_EQ(instance.value, 0);
|
|
|
}
|