Skip to content

Commit

Permalink
test: minor changes to please the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Oct 14, 2024
1 parent 6b20a3d commit e50f20e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/entt/core/type_traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ struct nlohmann_json_like final {
};

struct clazz {
char foo(int) {
return static_cast<char>(quux);
char foo(int value) {
return static_cast<char>(quux = (value != 0));
}

[[nodiscard]] int bar(double, float) const {
Expand Down
8 changes: 4 additions & 4 deletions test/entt/meta/meta_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<int>(), value.get_mul());
ASSERT_EQ(local.invoke("func"_hs, instance, value).cast<int>(), instance.value);
ASSERT_NE(instance.value, value.get_mul());

ASSERT_FALSE(global.invoke("get"_hs, instance));
Expand Down Expand Up @@ -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<int>(), value.get_mul());
ASSERT_EQ(local.func("func"_hs).invoke(instance, value).cast<int>(), instance.value);
ASSERT_NE(instance.value, value.get_mul());

ASSERT_FALSE(global.func("get"_hs));
Expand Down
6 changes: 3 additions & 3 deletions test/entt/meta/meta_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ struct setter_getter {
return value = static_cast<int>(val);
}

int getter() {
int getter() const {
return value;
}

int setter_with_ref(const int &val) {
return value = val;
}

const int &getter_with_ref() {
const int &getter_with_ref() const {
return value;
}

Expand Down Expand Up @@ -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<clazz>().data("i"_hs).set(instance, instance));
Expand Down
6 changes: 4 additions & 2 deletions test/entt/meta/meta_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<clazz &>().value = 3;

clazz::value = 3;

ASSERT_FALSE((entt::meta_invoke<clazz>({}, &clazz::setter, std::next(args.data()))));
ASSERT_FALSE((entt::meta_invoke<clazz>({}, &clazz::getter, nullptr)));
Expand All @@ -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<clazz &>().value = 3;

clazz::value = 3;

ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::setter>({}, std::next(args.data()))));
ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::getter>({}, nullptr)));
Expand Down

0 comments on commit e50f20e

Please sign in to comment.