From b7e8bb265f057a0db74c68be679a7f7176d3a5a5 Mon Sep 17 00:00:00 2001 From: skypjack Date: Mon, 2 Mar 2026 14:09:55 +0100 Subject: [PATCH] test: use the mixin design a little more --- TODO | 1 - test/common/non_default_constructible.h | 17 ----------------- test/common/value_type.h | 8 ++++++++ test/entt/core/compressed_pair.cpp | 2 +- test/entt/entity/registry.cpp | 1 - test/entt/entity/sigh_mixin.cpp | 1 - test/entt/meta/meta_container.cpp | 2 +- 7 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 test/common/non_default_constructible.h diff --git a/TODO b/TODO index 55a3fbb0c..49e0617e6 100644 --- a/TODO +++ b/TODO @@ -34,7 +34,6 @@ TODO: * organizer: view/storage only based model, no registry * introduce a way to inject stl from outside too * redesign snapshot as a whole -* use the value type mixin more in the test suite to reduce the number of utility types * explore "runtime" mode for hashed string where the source is copied internally * storage: shrink_to_fit does not work with reentrant destructor? * test trivially_destructible optimization diff --git a/test/common/non_default_constructible.h b/test/common/non_default_constructible.h deleted file mode 100644 index cd84a5970..000000000 --- a/test/common/non_default_constructible.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ENTT_COMMON_NON_DEFAULT_CONSTRUCTIBLE_H -#define ENTT_COMMON_NON_DEFAULT_CONSTRUCTIBLE_H - -namespace test { - -struct non_default_constructible { - non_default_constructible() = delete; - - non_default_constructible(int v) - : value{v} {} - - int value; -}; - -} // namespace test - -#endif diff --git a/test/common/value_type.h b/test/common/value_type.h index 286b47d87..b155fe11f 100644 --- a/test/common/value_type.h +++ b/test/common/value_type.h @@ -15,6 +15,13 @@ struct pointer_stable_mixin: Type { using Type::operator=; }; +template +struct non_default_constructible_mixin: Type { + using Type::Type; + using Type::operator=; + non_default_constructible_mixin() = delete; +}; + template struct non_trivially_destructible_mixin: Type { using Type::Type; @@ -49,6 +56,7 @@ struct value_type { } // namespace internal using pointer_stable = internal::pointer_stable_mixin; +using non_default_constructible = internal::non_default_constructible_mixin; using non_trivially_destructible = internal::non_trivially_destructible_mixin; using pointer_stable_non_trivially_destructible = internal::pointer_stable_mixin>; using non_comparable = internal::non_comparable_mixin; diff --git a/test/entt/core/compressed_pair.cpp b/test/entt/core/compressed_pair.cpp index 2a0d89cd4..c86f1737e 100644 --- a/test/entt/core/compressed_pair.cpp +++ b/test/entt/core/compressed_pair.cpp @@ -7,7 +7,7 @@ #include #include #include "../../common/empty.h" -#include "../../common/non_default_constructible.h" +#include "../../common/value_type.h" TEST(CompressedPair, Size) { struct local { diff --git a/test/entt/entity/registry.cpp b/test/entt/entity/registry.cpp index efe0054d6..729d87c5c 100644 --- a/test/entt/entity/registry.cpp +++ b/test/entt/entity/registry.cpp @@ -23,7 +23,6 @@ #include "../../common/config.h" #include "../../common/empty.h" #include "../../common/mixin.hpp" -#include "../../common/non_default_constructible.h" #include "../../common/value_type.h" struct Registry: testing::Test { diff --git a/test/entt/entity/sigh_mixin.cpp b/test/entt/entity/sigh_mixin.cpp index 161fcccc3..461bd2bc2 100644 --- a/test/entt/entity/sigh_mixin.cpp +++ b/test/entt/entity/sigh_mixin.cpp @@ -13,7 +13,6 @@ #include #include "../../common/config.h" #include "../../common/linter.hpp" -#include "../../common/non_default_constructible.h" #include "../../common/registry.h" #include "../../common/throwing_allocator.hpp" #include "../../common/throwing_type.hpp" diff --git a/test/entt/meta/meta_container.cpp b/test/entt/meta/meta_container.cpp index 6744e90f0..a9b1d32d6 100644 --- a/test/entt/meta/meta_container.cpp +++ b/test/entt/meta/meta_container.cpp @@ -15,7 +15,7 @@ #include #include "../../common/config.h" #include "../../common/empty.h" -#include "../../common/non_default_constructible.h" +#include "../../common/value_type.h" TEST(MetaContainer, Invalid) { ASSERT_FALSE(entt::meta_any{0}.as_sequence_container());