From cffbf89d9b9bf7f0b02fe3999d7f52b9eb60b823 Mon Sep 17 00:00:00 2001 From: skypjack Date: Sat, 15 Nov 2025 18:50:57 +0100 Subject: [PATCH] test: refine lib tests --- test/lib/dispatcher/shared/lib.cpp | 1 + test/lib/dispatcher/shared/lib.h | 4 ++++ test/lib/dispatcher/shared/main.cpp | 3 +-- test/lib/emitter/shared/lib.cpp | 1 + test/lib/emitter/shared/lib.h | 4 ++++ test/lib/emitter/shared/main.cpp | 3 +-- test/lib/locator/shared/lib.cpp | 1 + test/lib/locator/shared/lib.h | 6 ++++++ test/lib/locator/shared/main.cpp | 4 +--- test/lib/meta/shared/lib.cpp | 5 +++++ test/lib/meta/shared/lib.h | 8 ++++++++ test/lib/meta/shared/main.cpp | 6 +----- test/lib/registry/shared/lib.cpp | 1 + test/lib/registry/shared/lib.h | 5 +++++ test/lib/registry/shared/main.cpp | 4 +--- test/lib/view/shared/lib.cpp | 1 + test/lib/view/shared/lib.h | 4 ++++ test/lib/view/shared/main.cpp | 3 +-- 18 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 test/lib/dispatcher/shared/lib.h create mode 100644 test/lib/emitter/shared/lib.h create mode 100644 test/lib/locator/shared/lib.h create mode 100644 test/lib/meta/shared/lib.h create mode 100644 test/lib/registry/shared/lib.h create mode 100644 test/lib/view/shared/lib.h diff --git a/test/lib/dispatcher/shared/lib.cpp b/test/lib/dispatcher/shared/lib.cpp index f9acd446e..c034c3479 100644 --- a/test/lib/dispatcher/shared/lib.cpp +++ b/test/lib/dispatcher/shared/lib.cpp @@ -2,6 +2,7 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/empty.h" +#include "lib.h" ENTT_API void trigger(entt::dispatcher &dispatcher) { dispatcher.trigger(); diff --git a/test/lib/dispatcher/shared/lib.h b/test/lib/dispatcher/shared/lib.h new file mode 100644 index 000000000..50efdf6e7 --- /dev/null +++ b/test/lib/dispatcher/shared/lib.h @@ -0,0 +1,4 @@ +#include +#include + +ENTT_API void trigger(entt::dispatcher &); diff --git a/test/lib/dispatcher/shared/main.cpp b/test/lib/dispatcher/shared/main.cpp index 01fefe463..c5ef80e9a 100644 --- a/test/lib/dispatcher/shared/main.cpp +++ b/test/lib/dispatcher/shared/main.cpp @@ -5,8 +5,7 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/listener.h" - -ENTT_API void trigger(entt::dispatcher &); +#include "lib.h" TEST(Lib, Dispatcher) { entt::dispatcher dispatcher; diff --git a/test/lib/emitter/shared/lib.cpp b/test/lib/emitter/shared/lib.cpp index ea6e0b9f6..5cd1b7cb8 100644 --- a/test/lib/emitter/shared/lib.cpp +++ b/test/lib/emitter/shared/lib.cpp @@ -2,6 +2,7 @@ #include "../../../common/boxed_type.h" #include "../../../common/emitter.h" #include "../../../common/empty.h" +#include "lib.h" ENTT_API void emit(test::emitter &emitter) { emitter.publish(test::empty{}); diff --git a/test/lib/emitter/shared/lib.h b/test/lib/emitter/shared/lib.h new file mode 100644 index 000000000..5d8414e8c --- /dev/null +++ b/test/lib/emitter/shared/lib.h @@ -0,0 +1,4 @@ +#include +#include "../../../common/emitter.h" + +ENTT_API void emit(test::emitter &); diff --git a/test/lib/emitter/shared/main.cpp b/test/lib/emitter/shared/main.cpp index 898987488..e2e250ea2 100644 --- a/test/lib/emitter/shared/main.cpp +++ b/test/lib/emitter/shared/main.cpp @@ -3,8 +3,7 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/emitter.h" - -ENTT_API void emit(test::emitter &); +#include "lib.h" TEST(Lib, Emitter) { test::emitter emitter; diff --git a/test/lib/locator/shared/lib.cpp b/test/lib/locator/shared/lib.cpp index 24b4e8a9c..c3ae4d361 100644 --- a/test/lib/locator/shared/lib.cpp +++ b/test/lib/locator/shared/lib.cpp @@ -1,6 +1,7 @@ #include #include #include "../../../common/boxed_type.h" +#include "lib.h" ENTT_API void set_up(const entt::locator::node_type &handle) { entt::locator::reset(handle); diff --git a/test/lib/locator/shared/lib.h b/test/lib/locator/shared/lib.h new file mode 100644 index 000000000..09aa1e568 --- /dev/null +++ b/test/lib/locator/shared/lib.h @@ -0,0 +1,6 @@ +#include +#include +#include "../../../common/boxed_type.h" + +ENTT_API void set_up(const entt::locator::node_type &); +ENTT_API void use_service(int); diff --git a/test/lib/locator/shared/main.cpp b/test/lib/locator/shared/main.cpp index b2abb5848..b4078810a 100644 --- a/test/lib/locator/shared/main.cpp +++ b/test/lib/locator/shared/main.cpp @@ -2,9 +2,7 @@ #include #include #include "../../../common/boxed_type.h" - -ENTT_API void set_up(const entt::locator::node_type &); -ENTT_API void use_service(int); +#include "lib.h" TEST(Lib, Locator) { entt::locator::emplace().value = 4; diff --git a/test/lib/meta/shared/lib.cpp b/test/lib/meta/shared/lib.cpp index 13ed6e632..80d133c40 100644 --- a/test/lib/meta/shared/lib.cpp +++ b/test/lib/meta/shared/lib.cpp @@ -6,11 +6,16 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/empty.h" +#include "lib.h" + +namespace { test::boxed_int create_boxed_int(int value) { return test::boxed_int{value}; } +} // namespace + ENTT_API void share(const entt::locator::node_type &handle) { entt::locator::reset(handle); } diff --git a/test/lib/meta/shared/lib.h b/test/lib/meta/shared/lib.h new file mode 100644 index 000000000..eabc1e16c --- /dev/null +++ b/test/lib/meta/shared/lib.h @@ -0,0 +1,8 @@ +#include +#include +#include + +ENTT_API void share(const entt::locator::node_type &); +ENTT_API void set_up(); +ENTT_API void tear_down(); +ENTT_API entt::meta_any wrap_int(int); diff --git a/test/lib/meta/shared/main.cpp b/test/lib/meta/shared/main.cpp index 9144b11be..1d5f0d562 100644 --- a/test/lib/meta/shared/main.cpp +++ b/test/lib/meta/shared/main.cpp @@ -7,11 +7,7 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/empty.h" - -ENTT_API void share(const entt::locator::node_type &); -ENTT_API void set_up(); -ENTT_API void tear_down(); -ENTT_API entt::meta_any wrap_int(int); +#include "lib.h" TEST(Lib, Meta) { using namespace entt::literals; diff --git a/test/lib/registry/shared/lib.cpp b/test/lib/registry/shared/lib.cpp index 99ec00ce0..14106b5ff 100644 --- a/test/lib/registry/shared/lib.cpp +++ b/test/lib/registry/shared/lib.cpp @@ -4,6 +4,7 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/empty.h" +#include "lib.h" template class entt::basic_registry; diff --git a/test/lib/registry/shared/lib.h b/test/lib/registry/shared/lib.h new file mode 100644 index 000000000..3d4fc35e5 --- /dev/null +++ b/test/lib/registry/shared/lib.h @@ -0,0 +1,5 @@ +#include +#include + +ENTT_API void update(entt::registry &, int); +ENTT_API void insert(entt::registry &); diff --git a/test/lib/registry/shared/main.cpp b/test/lib/registry/shared/main.cpp index ffd0220d5..8991ff400 100644 --- a/test/lib/registry/shared/main.cpp +++ b/test/lib/registry/shared/main.cpp @@ -6,9 +6,7 @@ #include #include "../../../common/boxed_type.h" #include "../../../common/empty.h" - -ENTT_API void update(entt::registry &, int); -ENTT_API void insert(entt::registry &); +#include "lib.h" TEST(Lib, Registry) { constexpr auto count = 3; diff --git a/test/lib/view/shared/lib.cpp b/test/lib/view/shared/lib.cpp index 70ba8c8ee..907aea56d 100644 --- a/test/lib/view/shared/lib.cpp +++ b/test/lib/view/shared/lib.cpp @@ -1,5 +1,6 @@ #include #include "../types.h" +#include "lib.h" ENTT_API const void *filter(const view_type &view) { // forces the creation of all symbols for the view type diff --git a/test/lib/view/shared/lib.h b/test/lib/view/shared/lib.h new file mode 100644 index 000000000..151ce2de8 --- /dev/null +++ b/test/lib/view/shared/lib.h @@ -0,0 +1,4 @@ +#include +#include "../types.h" + +ENTT_API const void *filter(const view_type &); diff --git a/test/lib/view/shared/main.cpp b/test/lib/view/shared/main.cpp index d6af5749d..d594455b3 100644 --- a/test/lib/view/shared/main.cpp +++ b/test/lib/view/shared/main.cpp @@ -1,8 +1,7 @@ #include #include #include "../types.h" - -ENTT_API const void *filter(const view_type &); +#include "lib.h" TEST(Lib, View) { view_type view{};