Explorar o código

meta: updated tests, CR_UNLOAD isn't passed on close

Michele Caini %!s(int64=6) %!d(string=hai) anos
pai
achega
a32373bc3a
Modificáronse 2 ficheiros con 6 adicións e 2 borrados
  1. 4 0
      test/plugin/meta/main.cpp
  2. 2 2
      test/plugin/meta/plugin.cpp

+ 4 - 0
test/plugin/meta/main.cpp

@@ -21,6 +21,7 @@ TEST(Lib, Meta) {
     cr_plugin_update(ctx);
     cr_plugin_update(ctx);
 
 
     ASSERT_TRUE(entt::resolve("position"_hs));
     ASSERT_TRUE(entt::resolve("position"_hs));
+    ASSERT_TRUE(entt::resolve("velocity"_hs));
     ASSERT_TRUE(entt::resolve<double>().conv<int>());
     ASSERT_TRUE(entt::resolve<double>().conv<int>());
 
 
     auto pos = entt::resolve("position"_hs).construct(42., 3.);
     auto pos = entt::resolve("position"_hs).construct(42., 3.);
@@ -47,4 +48,7 @@ TEST(Lib, Meta) {
     ud.any.emplace<void>();
     ud.any.emplace<void>();
 
 
     cr_plugin_close(ctx);
     cr_plugin_close(ctx);
+
+    ASSERT_FALSE(entt::resolve("position"_hs));
+    ASSERT_FALSE(entt::resolve("velocity"_hs));
 }
 }

+ 2 - 2
test/plugin/meta/plugin.cpp

@@ -42,10 +42,10 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
         static_cast<userdata *>(ctx->userdata)->any = 42;
         static_cast<userdata *>(ctx->userdata)->any = 42;
         break;
         break;
     case CR_UNLOAD:
     case CR_UNLOAD:
-        tear_down();
+        // nothing to do here, this is only a test.
         break;
         break;
     case CR_CLOSE:
     case CR_CLOSE:
-        // nothing to do here, this is only a test.
+        tear_down();
         break;
         break;
     }
     }