test: use the mixin design a little more

This commit is contained in:
skypjack
2026-03-02 14:09:55 +01:00
parent b5797912d3
commit b7e8bb265f
7 changed files with 10 additions and 22 deletions

1
TODO
View File

@@ -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

View File

@@ -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

View File

@@ -15,6 +15,13 @@ struct pointer_stable_mixin: Type {
using Type::operator=;
};
template<typename Type>
struct non_default_constructible_mixin: Type {
using Type::Type;
using Type::operator=;
non_default_constructible_mixin() = delete;
};
template<typename Type>
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<internal::value_type>;
using non_default_constructible = internal::non_default_constructible_mixin<internal::value_type>;
using non_trivially_destructible = internal::non_trivially_destructible_mixin<internal::value_type>;
using pointer_stable_non_trivially_destructible = internal::pointer_stable_mixin<internal::non_trivially_destructible_mixin<internal::value_type>>;
using non_comparable = internal::non_comparable_mixin<internal::value_type>;

View File

@@ -7,7 +7,7 @@
#include <gtest/gtest.h>
#include <entt/core/compressed_pair.hpp>
#include "../../common/empty.h"
#include "../../common/non_default_constructible.h"
#include "../../common/value_type.h"
TEST(CompressedPair, Size) {
struct local {

View File

@@ -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 {

View File

@@ -13,7 +13,6 @@
#include <entt/signal/sigh.hpp>
#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"

View File

@@ -15,7 +15,7 @@
#include <entt/meta/resolve.hpp>
#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());