From d893af429f97a24cc4ed1d80cb15b20695d34ed1 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 28 Oct 2024 09:09:46 +0100 Subject: [PATCH] test: cleanup/review --- test/entt/meta/meta_context.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/test/entt/meta/meta_context.cpp b/test/entt/meta/meta_context.cpp index f6d66fb3f..5c1ea34b1 100644 --- a/test/entt/meta/meta_context.cpp +++ b/test/entt/meta/meta_context.cpp @@ -86,7 +86,7 @@ class MetaContext: public ::testing::Test { entt::meta() .type("foo"_hs) - .prop("prop"_hs, prop_value) + .custom(3) .ctor() .data<&clazz::value>("value"_hs) .data<&clazz::value>("rw"_hs) @@ -114,7 +114,7 @@ class MetaContext: public ::testing::Test { entt::meta(context) .type("bar"_hs) - .prop("prop"_hs, prop_value) + .custom('c') .base() .ctor() .dtor<&clazz::move_to_bucket>() @@ -147,7 +147,6 @@ class MetaContext: public ::testing::Test { static constexpr int global_marker = 1; static constexpr int local_marker = 4; static constexpr int bucket_value = 2; - static constexpr int prop_value = 3; private: entt::meta_ctx context{}; @@ -352,23 +351,17 @@ TEST_F(MetaContext, MetaDtor) { ASSERT_NE(clazz::bucket, bucket_value); } -TEST_F(MetaContext, MetaProp) { +TEST_F(MetaContext, MetaCustom) { using namespace entt::literals; const auto global = entt::resolve(); const auto local = entt::resolve(ctx()); - ASSERT_TRUE(global.prop("prop"_hs)); - ASSERT_TRUE(local.prop("prop"_hs)); + ASSERT_NE(static_cast(global.custom()), nullptr); + ASSERT_NE(static_cast(local.custom()), nullptr); - ASSERT_EQ(global.prop("prop"_hs).value().type(), entt::resolve()); - ASSERT_EQ(local.prop("prop"_hs).value().type(), entt::resolve(ctx())); - - ASSERT_EQ(global.prop("prop"_hs).value().cast(), prop_value); - ASSERT_EQ(local.prop("prop"_hs).value().cast(), prop_value); - - ASSERT_EQ(global.prop("prop"_hs).value().type().data("marker"_hs).get({}).cast(), global_marker); - ASSERT_EQ(local.prop("prop"_hs).value().type().data("marker"_hs).get({}).cast(), local_marker); + ASSERT_EQ(static_cast(global.custom()), 3); + ASSERT_EQ(static_cast(local.custom()), 'c'); } TEST_F(MetaContext, MetaTemplate) {