From e50f20ebf49447c3d95d5ced10a80b3a4c85ae03 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 14 Oct 2024 12:31:47 +0200 Subject: [PATCH] test: minor changes to please the linter --- test/entt/core/type_traits.cpp | 4 ++-- test/entt/meta/meta_context.cpp | 8 ++++---- test/entt/meta/meta_data.cpp | 6 +++--- test/entt/meta/meta_utility.cpp | 6 ++++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/entt/core/type_traits.cpp b/test/entt/core/type_traits.cpp index 2d896d7f6..b891233c9 100644 --- a/test/entt/core/type_traits.cpp +++ b/test/entt/core/type_traits.cpp @@ -19,8 +19,8 @@ struct nlohmann_json_like final { }; struct clazz { - char foo(int) { - return static_cast(quux); + char foo(int value) { + return static_cast(quux = (value != 0)); } [[nodiscard]] int bar(double, float) const { diff --git a/test/entt/meta/meta_context.cpp b/test/entt/meta/meta_context.cpp index a8152294d..f6d66fb3f 100644 --- a/test/entt/meta/meta_context.cpp +++ b/test/entt/meta/meta_context.cpp @@ -43,8 +43,8 @@ struct clazz: base { return (value = iv); } - [[nodiscard]] int cfunc(int iv) const { - return iv; + [[nodiscard]] int cfunc(int) const { + return value; } static void move_to_bucket(const clazz &instance) { @@ -206,7 +206,7 @@ TEST_F(MetaContext, MetaType) { ASSERT_EQ(instance.value, value.get()); ASSERT_NE(instance.value, value.get_mul()); - ASSERT_EQ(local.invoke("func"_hs, instance, value).cast(), value.get_mul()); + ASSERT_EQ(local.invoke("func"_hs, instance, value).cast(), instance.value); ASSERT_NE(instance.value, value.get_mul()); ASSERT_FALSE(global.invoke("get"_hs, instance)); @@ -287,7 +287,7 @@ TEST_F(MetaContext, MetaFunc) { ASSERT_EQ(instance.value, value.get()); ASSERT_NE(instance.value, value.get_mul()); - ASSERT_EQ(local.func("func"_hs).invoke(instance, value).cast(), value.get_mul()); + ASSERT_EQ(local.func("func"_hs).invoke(instance, value).cast(), instance.value); ASSERT_NE(instance.value, value.get_mul()); ASSERT_FALSE(global.func("get"_hs)); diff --git a/test/entt/meta/meta_data.cpp b/test/entt/meta/meta_data.cpp index 9ae154dc7..c7d75d28b 100644 --- a/test/entt/meta/meta_data.cpp +++ b/test/entt/meta/meta_data.cpp @@ -47,7 +47,7 @@ struct setter_getter { return value = static_cast(val); } - int getter() { + int getter() const { return value; } @@ -55,7 +55,7 @@ struct setter_getter { return value = val; } - const int &getter_with_ref() { + const int &getter_with_ref() const { return value; } @@ -366,7 +366,7 @@ TEST_F(MetaData, SetConvert) { using namespace entt::literals; clazz instance{}; - instance.h = 1; + clazz::h = 1; ASSERT_EQ(instance.i, 0); ASSERT_TRUE(entt::resolve().data("i"_hs).set(instance, instance)); diff --git a/test/entt/meta/meta_utility.cpp b/test/entt/meta/meta_utility.cpp index 8cf31b033..e8cab8cf5 100644 --- a/test/entt/meta/meta_utility.cpp +++ b/test/entt/meta/meta_utility.cpp @@ -190,7 +190,8 @@ TEST_F(MetaUtility, MetaGetter) { TEST_F(MetaUtility, MetaInvokeWithCandidate) { std::array args{entt::meta_any{clazz{}}, entt::meta_any{4}}; - args[0u].cast().value = 3; + + clazz::value = 3; ASSERT_FALSE((entt::meta_invoke({}, &clazz::setter, std::next(args.data())))); ASSERT_FALSE((entt::meta_invoke({}, &clazz::getter, nullptr))); @@ -213,7 +214,8 @@ TEST_F(MetaUtility, MetaInvokeWithCandidate) { TEST_F(MetaUtility, MetaInvoke) { std::array args{entt::meta_any{clazz{}}, entt::meta_any{4}}; - args[0u].cast().value = 3; + + clazz::value = 3; ASSERT_FALSE((entt::meta_invoke({}, std::next(args.data())))); ASSERT_FALSE((entt::meta_invoke({}, nullptr)));