Prechádzať zdrojové kódy

test: context aware forward_as_meta

Michele Caini 3 rokov pred
rodič
commit
4a0a534796
1 zmenil súbory, kde vykonal 12 pridanie a 1 odobranie
  1. 12 1
      test/entt/meta/meta_context.cpp

+ 12 - 1
test/entt/meta/meta_context.cpp

@@ -1,7 +1,9 @@
 #include <gtest/gtest.h>
 #include <entt/core/hashed_string.hpp>
+#include <entt/meta/container.hpp>
 #include <entt/meta/context.hpp>
 #include <entt/meta/factory.hpp>
+#include <entt/meta/pointer.hpp>
 #include <entt/meta/template.hpp>
 
 struct base {};
@@ -345,7 +347,16 @@ TEST_F(MetaContext, MetaHandle) {
 }
 
 TEST_F(MetaContext, ForwardAsMeta) {
-    // TODO
+    using namespace entt::literals;
+
+    const auto global = entt::forward_as_meta(42);
+    const auto local = entt::forward_as_meta(context, 42);
+
+    ASSERT_TRUE(global);
+    ASSERT_TRUE(local);
+
+    ASSERT_EQ(global.type().data("marker"_hs).get({}).cast<int>(), global_marker);
+    ASSERT_EQ(local.type().data("marker"_hs).get({}).cast<int>(), local_marker);
 }
 
 TEST_F(MetaContext, ContextMix) {