From 7121da100ad37bbd609ee6cfdb6286576e38cd6a Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 13 Oct 2022 09:24:20 +0200 Subject: [PATCH] test: context aware meta sequence containers --- test/entt/meta/meta_context.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/entt/meta/meta_context.cpp b/test/entt/meta/meta_context.cpp index d84d1da1a..f212d26fd 100644 --- a/test/entt/meta/meta_context.cpp +++ b/test/entt/meta/meta_context.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include #include @@ -349,7 +351,24 @@ TEST_F(MetaContext, MetaAssociativeContainer) { } TEST_F(MetaContext, MetaSequenceContainer) { - // TODO + using namespace entt::literals; + + std::vector vec{0}; + + auto global = entt::forward_as_meta(vec).as_sequence_container(); + auto local = entt::forward_as_meta(context, vec).as_sequence_container(); + + ASSERT_TRUE(global); + ASSERT_TRUE(local); + + ASSERT_EQ(global.size(), 1u); + ASSERT_EQ(local.size(), 1u); + + ASSERT_EQ(global.value_type().data("marker"_hs).get({}).cast(), global_marker); + ASSERT_EQ(local.value_type().data("marker"_hs).get({}).cast(), local_marker); + + ASSERT_EQ((*global.begin()).type().data("marker"_hs).get({}).cast(), global_marker); + ASSERT_EQ((*local.begin()).type().data("marker"_hs).get({}).cast(), local_marker); } TEST_F(MetaContext, MetaAny) {