Skip to content

Commit

Permalink
test: internal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Oct 26, 2024
1 parent 8507164 commit c76fff8
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion test/entt/meta/meta_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct MetaBase: ::testing::Test {
}
};

TEST_F(MetaBase, Functionalities) {
TEST_F(MetaBase, Base) {
auto any = entt::resolve<derived>().construct();
any.cast<derived &>().value_1 = 2;
auto as_derived = any.as_ref();
Expand Down
2 changes: 1 addition & 1 deletion test/entt/meta/meta_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct MetaConv: ::testing::Test {
}
};

TEST_F(MetaConv, Functionalities) {
TEST_F(MetaConv, Conv) {
auto any = entt::resolve<clazz>().construct();
any.cast<clazz &>().value = 2;

Expand Down
2 changes: 1 addition & 1 deletion test/entt/meta/meta_ctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct MetaCtor: ::testing::Test {
}
};

TEST_F(MetaCtor, Functionalities) {
TEST_F(MetaCtor, Ctor) {
auto any = entt::resolve<clazz>().construct(1, 'c');

ASSERT_TRUE(any);
Expand Down
4 changes: 2 additions & 2 deletions test/entt/meta/meta_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct MetaCustom: ::testing::Test {

using MetaCustomDeathTest = MetaCustom;

TEST_F(MetaCustom, Functionalities) {
TEST_F(MetaCustom, Custom) {
entt::meta_custom custom{};

ASSERT_EQ(static_cast<const char *>(custom), nullptr);
Expand All @@ -53,7 +53,7 @@ TEST_F(MetaCustom, Functionalities) {
ASSERT_EQ(static_cast<const char &>(custom), 'c');
}

ENTT_DEBUG_TEST_F(MetaCustomDeathTest, Functionalities) {
ENTT_DEBUG_TEST_F(MetaCustomDeathTest, Custom) {
entt::meta_custom custom{};

ASSERT_DEATH([[maybe_unused]] const char &value = custom, "");
Expand Down
72 changes: 36 additions & 36 deletions test/entt/meta/meta_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,42 +155,6 @@ struct MetaData: ::testing::Test {

using MetaDataDeathTest = MetaData;

TEST_F(MetaData, Functionalities) {
using namespace entt::literals;

auto data = entt::resolve<clazz>().data("i"_hs);
clazz instance{};

ASSERT_TRUE(data);

ASSERT_EQ(data, data);
ASSERT_NE(data, entt::meta_data{});
ASSERT_FALSE(data != data);
ASSERT_TRUE(data == data);

ASSERT_EQ(data.arity(), 1u);
ASSERT_EQ(data.type(), entt::resolve<int>());
ASSERT_EQ(data.arg(0u), entt::resolve<int>());
ASSERT_FALSE(data.is_const());
ASSERT_FALSE(data.is_static());
ASSERT_EQ(data.get(instance).cast<int>(), 0);
ASSERT_TRUE(data.set(instance, 1));
ASSERT_EQ(data.get(instance).cast<int>(), 1);

for(auto curr: data.prop()) {
ASSERT_EQ(curr.first, 3u);
ASSERT_EQ(curr.second.value(), 0);
}

ASSERT_FALSE(data.prop(2));
ASSERT_FALSE(data.prop('c'));

auto prop = data.prop(3u);

ASSERT_TRUE(prop);
ASSERT_EQ(prop.value(), 0);
}

TEST_F(MetaData, UserTraits) {
using namespace entt::literals;

Expand Down Expand Up @@ -228,6 +192,42 @@ ENTT_DEBUG_TEST_F(MetaDataDeathTest, Custom) {
ASSERT_DEATH([[maybe_unused]] char value = entt::resolve<clazz>().data("j"_hs).custom(), "");
}

TEST_F(MetaData, NonConst) {
using namespace entt::literals;

auto data = entt::resolve<clazz>().data("i"_hs);
clazz instance{};

ASSERT_TRUE(data);

ASSERT_EQ(data, data);
ASSERT_NE(data, entt::meta_data{});
ASSERT_FALSE(data != data);
ASSERT_TRUE(data == data);

ASSERT_EQ(data.arity(), 1u);
ASSERT_EQ(data.type(), entt::resolve<int>());
ASSERT_EQ(data.arg(0u), entt::resolve<int>());
ASSERT_FALSE(data.is_const());
ASSERT_FALSE(data.is_static());
ASSERT_EQ(data.get(instance).cast<int>(), 0);
ASSERT_TRUE(data.set(instance, 1));
ASSERT_EQ(data.get(instance).cast<int>(), 1);

for(auto curr: data.prop()) {
ASSERT_EQ(curr.first, 3u);
ASSERT_EQ(curr.second.value(), 0);
}

ASSERT_FALSE(data.prop(2));
ASSERT_FALSE(data.prop('c'));

auto prop = data.prop(3u);

ASSERT_TRUE(prop);
ASSERT_EQ(prop.value(), 0);
}

TEST_F(MetaData, Const) {
using namespace entt::literals;

Expand Down
2 changes: 1 addition & 1 deletion test/entt/meta/meta_dtor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct MetaDtor: ::testing::Test {
}
};

TEST_F(MetaDtor, Functionalities) {
TEST_F(MetaDtor, Dtor) {
int counter{};

auto any = entt::resolve<clazz>().construct(entt::forward_as_meta(counter));
Expand Down
2 changes: 1 addition & 1 deletion test/entt/meta/meta_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct MetaHandle: ::testing::Test {
}
};

TEST_F(MetaHandle, Functionalities) {
TEST_F(MetaHandle, Handle) {
using namespace entt::literals;

clazz instance{};
Expand Down
2 changes: 1 addition & 1 deletion test/entt/meta/meta_prop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct MetaProp: ::testing::Test {
}
};

TEST_F(MetaProp, Functionalities) {
TEST_F(MetaProp, Prop) {
using namespace entt::literals;

auto prop = entt::resolve<base_1>().prop("int"_hs);
Expand Down

0 comments on commit c76fff8

Please sign in to comment.