test: non-regression tests for meta_type::lookup constness
This commit is contained in:
@@ -654,6 +654,12 @@ TEST_F(MetaFunc, OverloadedConstFirst) {
|
||||
|
||||
ASSERT_EQ(func.invoke(std::as_const(instance), 1).cast<int>(), 2);
|
||||
ASSERT_FALSE(next.invoke(std::as_const(instance), 1));
|
||||
|
||||
ASSERT_EQ(func.invoke(entt::meta_handle{instance}, entt::meta_any{1}).cast<int>(), 2);
|
||||
ASSERT_EQ(next.invoke(entt::meta_handle{instance}, entt::meta_any{1}).cast<int>(), 1);
|
||||
|
||||
ASSERT_EQ(func.invoke(entt::meta_handle{std::as_const(instance)}, entt::meta_any{1}).cast<int>(), 2);
|
||||
ASSERT_FALSE(next.invoke(entt::meta_handle{std::as_const(instance)}, entt::meta_any{1}));
|
||||
}
|
||||
|
||||
TEST_F(MetaFunc, OverloadedNonConstFirst) {
|
||||
@@ -680,6 +686,12 @@ TEST_F(MetaFunc, OverloadedNonConstFirst) {
|
||||
|
||||
ASSERT_FALSE(func.invoke(std::as_const(instance), 1));
|
||||
ASSERT_EQ(next.invoke(std::as_const(instance), 1).cast<int>(), 2);
|
||||
|
||||
ASSERT_EQ(func.invoke(entt::meta_handle{instance}, entt::meta_any{1}).cast<int>(), 1);
|
||||
ASSERT_EQ(next.invoke(entt::meta_handle{instance}, entt::meta_any{1}).cast<int>(), 2);
|
||||
|
||||
ASSERT_FALSE(func.invoke(entt::meta_handle{std::as_const(instance)}, entt::meta_any{1}));
|
||||
ASSERT_EQ(next.invoke(entt::meta_handle{std::as_const(instance)}, entt::meta_any{1}).cast<int>(), 2);
|
||||
}
|
||||
|
||||
TEST_F(MetaFunc, OverloadedOrder) {
|
||||
|
||||
@@ -575,10 +575,15 @@ TEST_F(MetaType, OverloadedFuncConstFirst) {
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(res.cast<int>(), 2);
|
||||
|
||||
res = type.invoke("cf"_hs, overloaded_func{3}, 1);
|
||||
res = type.invoke("cf"_hs, entt::meta_handle{instance}, entt::meta_any{1});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(res.cast<int>(), 6);
|
||||
ASSERT_EQ(res.cast<int>(), 4);
|
||||
|
||||
res = type.invoke("cf"_hs, entt::meta_handle{std::as_const(instance)}, entt::meta_any{1});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(res.cast<int>(), 2);
|
||||
}
|
||||
|
||||
TEST_F(MetaType, OverloadedFuncNonConstFirst) {
|
||||
@@ -600,10 +605,15 @@ TEST_F(MetaType, OverloadedFuncNonConstFirst) {
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(res.cast<int>(), 2);
|
||||
|
||||
res = type.invoke("ncf"_hs, overloaded_func{3}, 1);
|
||||
res = type.invoke("ncf"_hs, entt::meta_handle{instance}, entt::meta_any{1});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(res.cast<int>(), 6);
|
||||
ASSERT_EQ(res.cast<int>(), 4);
|
||||
|
||||
res = type.invoke("ncf"_hs, entt::meta_handle{std::as_const(instance)}, entt::meta_any{1});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
ASSERT_EQ(res.cast<int>(), 2);
|
||||
}
|
||||
|
||||
TEST_F(MetaType, OverloadedFuncOrder) {
|
||||
|
||||
Reference in New Issue
Block a user