diff --git a/test/entt/meta/meta_func.cpp b/test/entt/meta/meta_func.cpp index e969cd7db..c8b2a550c 100644 --- a/test/entt/meta/meta_func.cpp +++ b/test/entt/meta/meta_func.cpp @@ -55,7 +55,7 @@ struct function { } [[nodiscard]] int f(int iv) const { - return iv * iv; + return value * iv; } void g(int iv) { @@ -248,7 +248,7 @@ TEST_F(MetaFunc, Const) { using namespace entt::literals; auto func = entt::resolve().func("f1"_hs); - function instance{}; + function instance{2}; ASSERT_TRUE(func); ASSERT_EQ(func.arity(), 1u); @@ -264,7 +264,7 @@ TEST_F(MetaFunc, Const) { ASSERT_FALSE(empty); ASSERT_TRUE(any); ASSERT_EQ(any.type(), entt::resolve()); - ASSERT_EQ(any.cast(), 16); + ASSERT_EQ(any.cast(), 8); for(auto curr: func.prop()) { ASSERT_EQ(curr.first, "true"_hs); @@ -462,7 +462,7 @@ TEST_F(MetaFunc, NonClassTypeMember) { TEST_F(MetaFunc, MetaAnyArgs) { using namespace entt::literals; - function instance; + function instance{3}; auto any = entt::resolve().func("f1"_hs).invoke(instance, 3); ASSERT_TRUE(any); @@ -535,7 +535,7 @@ TEST_F(MetaFunc, ArgsByConstRef) { TEST_F(MetaFunc, ConstInstance) { using namespace entt::literals; - function instance{}; + function instance{2}; auto any = entt::resolve().func("f1"_hs).invoke(std::as_const(instance), 2); ASSERT_FALSE(entt::resolve().func("g"_hs).invoke(std::as_const(instance), 1)); diff --git a/test/entt/meta/meta_type.cpp b/test/entt/meta/meta_type.cpp index c3b84947a..622599b7f 100644 --- a/test/entt/meta/meta_type.cpp +++ b/test/entt/meta/meta_type.cpp @@ -85,7 +85,7 @@ struct overloaded_func { } [[nodiscard]] int f(int val) const { - return val * val; + return val * value; } [[nodiscard]] float f(int first, const float second) { @@ -472,14 +472,14 @@ TEST_F(MetaType, OverloadedFunc) { ASSERT_TRUE(res); ASSERT_EQ(instance.value, 3); ASSERT_NE(res.try_cast(), nullptr); - ASSERT_EQ(res.cast(), 8); + ASSERT_EQ(res.cast(), 12); res = type.invoke("f"_hs, std::as_const(instance), 2); ASSERT_TRUE(res); ASSERT_EQ(instance.value, 3); ASSERT_NE(res.try_cast(), nullptr); - ASSERT_EQ(res.cast(), 4); + ASSERT_EQ(res.cast(), 6); res = type.invoke("f"_hs, instance, 0, 1.f); @@ -576,7 +576,7 @@ TEST_F(MetaType, ConstructCastAndConvert) { } TEST_F(MetaType, ConstructArithmeticConversion) { - auto any = entt::resolve().construct(derived{}, clazz{derived{}, true}); + auto any = entt::resolve().construct(derived{}, true); ASSERT_TRUE(any); ASSERT_EQ(any.cast().value, 1); diff --git a/test/entt/signal/delegate.cpp b/test/entt/signal/delegate.cpp index 2a0db4ec8..3850d8b5d 100644 --- a/test/entt/signal/delegate.cpp +++ b/test/entt/signal/delegate.cpp @@ -29,8 +29,8 @@ struct delegate_functor { return iv + iv; } - [[nodiscard]] int identity(int iv) const { - return iv; + [[nodiscard]] int mul(int iv) const { + return iv * data_member; } static const int static_value = 3; @@ -73,7 +73,7 @@ TEST(Delegate, Functionalities) { ff_del.connect<&power_of_two>(); mf_del.connect<&delegate_functor::operator()>(functor); - lf_del.connect([](const void *ptr, int value) { return static_cast(ptr)->identity(value); }, &functor); + lf_del.connect([](const void *ptr, int value) { return static_cast(ptr)->mul(value); }, &functor); ASSERT_TRUE(ff_del); ASSERT_TRUE(mf_del); @@ -81,7 +81,7 @@ TEST(Delegate, Functionalities) { ASSERT_EQ(ff_del(3), 9); ASSERT_EQ(mf_del(3), 6); - ASSERT_EQ(lf_del(3), 3); + ASSERT_EQ(lf_del(3), 12); ff_del.reset(); @@ -206,7 +206,7 @@ TEST(Delegate, Comparison) { ASSERT_FALSE(lhs == rhs); ASSERT_NE(lhs, rhs); - lhs.connect([](const void *ptr, int val) { return static_cast(ptr)->identity(val) * val; }, &functor); + lhs.connect([](const void *ptr, int val) { return static_cast(ptr)->mul(val) * val; }, &functor); ASSERT_NE(lhs, (entt::delegate{[](const void *, int val) { return val + val; }, &functor})); ASSERT_NE(lhs.target(), rhs.target()); @@ -215,7 +215,7 @@ TEST(Delegate, Comparison) { ASSERT_FALSE(lhs == rhs); ASSERT_NE(lhs, rhs); - rhs.connect([](const void *ptr, int val) { return static_cast(ptr)->identity(val) + val; }, &functor); + rhs.connect([](const void *ptr, int val) { return static_cast(ptr)->mul(val) + val; }, &functor); ASSERT_NE(rhs, (entt::delegate{[](const void *, int val) { return val * val; }, &functor})); ASSERT_TRUE(lhs != rhs); @@ -315,10 +315,10 @@ TEST(Delegate, ConstInstance) { ASSERT_FALSE(delegate); - delegate.connect<&delegate_functor::identity>(functor); + delegate.connect<&delegate_functor::mul>(functor); ASSERT_TRUE(delegate); - ASSERT_EQ(delegate(3), 3); + ASSERT_EQ(delegate(3), 12); delegate.reset(); @@ -416,7 +416,7 @@ TEST(Delegate, VoidVsNonVoidReturnType) { const entt::delegate func{entt::connect_arg<&power_of_two>}; const entt::delegate member{entt::connect_arg<&delegate_functor::operator()>, &functor}; - const entt::delegate cmember{entt::connect_arg<&delegate_functor::identity>, &std::as_const(functor)}; + const entt::delegate cmember{entt::connect_arg<&delegate_functor::mul>, &std::as_const(functor)}; ASSERT_TRUE(func); ASSERT_TRUE(member); @@ -455,9 +455,9 @@ TEST(Delegate, TheLessTheBetter) { ASSERT_EQ(bound(3, 'c'), 6); // int delegate_functor::operator()(int); - bound.connect<&delegate_functor::identity>(&functor); + bound.connect<&delegate_functor::mul>(&functor); - ASSERT_EQ(bound(3, 'c'), 3); + ASSERT_EQ(bound(3, 'c'), 12); // int delegate_functor::operator()(int); unbound.connect<&delegate_functor::operator()>();