test: use the mixin design a little more

This commit is contained in:
skypjack
2026-03-03 09:42:52 +01:00
parent 70d908d854
commit 3cf061201a
32 changed files with 27 additions and 41 deletions

View File

@@ -1,11 +0,0 @@
#ifndef ENTT_COMMON_EMPTY_H
#define ENTT_COMMON_EMPTY_H
namespace test {
struct empty {};
struct other_empty {};
} // namespace test
#endif

View File

@@ -64,6 +64,9 @@ using pointer_stable_non_trivially_destructible = internal::pointer_stable_mixin
using non_comparable = internal::non_comparable_mixin<internal::empty_type>;
using non_movable = internal::non_movable_mixin<internal::value_type>;
using empty = internal::empty_type;
struct other_empty: internal::empty_type {};
static_assert(std::is_trivially_destructible_v<test::pointer_stable>, "Not a trivially destructible type");
static_assert(!std::is_trivially_destructible_v<test::non_trivially_destructible>, "Trivially destructible type");
static_assert(!std::is_trivially_destructible_v<test::pointer_stable_non_trivially_destructible>, "Trivially destructible type");

View File

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

View File

@@ -2,7 +2,7 @@
#include <gtest/gtest.h>
#include <entt/core/ident.hpp>
#include "../../common/boxed_type.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
TEST(Ident, Uniqueness) {
using id = entt::ident<test::empty, test::boxed_int>;

View File

@@ -3,7 +3,6 @@
#include <entt/config/config.h>
#include <entt/entity/component.hpp>
#include "../../common/boxed_type.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
struct ComponentBase: testing::Test {

View File

@@ -13,7 +13,7 @@
#include <entt/signal/sigh.hpp>
#include "../../common/boxed_type.h"
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
TEST(GroupNonOwning, Functionalities) {
entt::registry registry;

View File

@@ -13,10 +13,10 @@
#include <entt/entity/storage.hpp>
#include <entt/signal/sigh.hpp>
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/linter.hpp"
#include "../../common/registry.h"
#include "../../common/throwing_allocator.hpp"
#include "../../common/value_type.h"
struct ReactiveMixinBase: testing::Test {
enum class my_entity : std::uint32_t {};

View File

@@ -21,7 +21,6 @@
#include <entt/signal/sigh.hpp>
#include "../../common/aggregate.h"
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/mixin.hpp"
#include "../../common/value_type.h"

View File

@@ -12,7 +12,6 @@
#include <entt/entity/snapshot.hpp>
#include <entt/signal/sigh.hpp>
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
struct SnapshotCommonBase: testing::Test {

View File

@@ -12,8 +12,8 @@
#include <entt/entity/entity.hpp>
#include <entt/entity/storage.hpp>
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/linter.hpp"
#include "../../common/value_type.h"
template<typename Type>
struct StorageNoInstance: testing::Test {

View File

@@ -9,7 +9,6 @@
#include <entt/entity/storage.hpp>
#include <entt/entity/view.hpp>
#include "../../common/boxed_type.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
TEST(ViewSingleStorage, Functionalities) {

View File

@@ -14,7 +14,6 @@
#include <entt/meta/meta.hpp>
#include <entt/meta/resolve.hpp>
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
TEST(MetaContainer, Invalid) {

View File

@@ -12,7 +12,7 @@
#include <entt/meta/pointer.hpp>
#include <entt/meta/resolve.hpp>
#include <entt/meta/template.hpp>
#include "../../common/empty.h"
#include "../../common/value_type.h"
class MetaContext: public ::testing::Test {
static void init_global_context() {

View File

@@ -8,7 +8,7 @@
#include <entt/meta/resolve.hpp>
#include <entt/meta/utility.hpp>
#include "../../common/config.h"
#include "../../common/empty.h"
#include "../../common/value_type.h"
struct MetaUtility: ::testing::Test {
struct clazz {

View File

@@ -2,7 +2,7 @@
#include <memory>
#include <gtest/gtest.h>
#include <entt/process/process.hpp>
#include "../../common/empty.h"
#include "../../common/value_type.h"
template<typename Delta>
class test_process: public entt::basic_process<Delta> {

View File

@@ -9,9 +9,9 @@
#include <entt/resource/cache.hpp>
#include <entt/resource/loader.hpp>
#include <entt/resource/resource.hpp>
#include "../../common/empty.h"
#include "../../common/linter.hpp"
#include "../../common/throwing_allocator.hpp"
#include "../../common/value_type.h"
template<typename Type>
struct loader {

View File

@@ -3,7 +3,7 @@
#include <gtest/gtest.h>
#include <entt/core/hashed_string.hpp>
#include <entt/signal/dispatcher.hpp>
#include "../../common/empty.h"
#include "../../common/value_type.h"
// makes the type non-aggregate
struct non_aggregate {

View File

@@ -5,8 +5,8 @@
#include <entt/signal/emitter.hpp>
#include "../../common/boxed_type.h"
#include "../../common/emitter.h"
#include "../../common/empty.h"
#include "../../common/linter.hpp"
#include "../../common/value_type.h"
TEST(Emitter, Move) {
test::emitter emitter{};

View File

@@ -1,7 +1,7 @@
#include <cr.h>
#include <entt/signal/dispatcher.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
switch(operation) {

View File

@@ -1,7 +1,7 @@
#include <entt/config/config.h>
#include <entt/signal/dispatcher.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "lib.h"
ENTT_API void trigger(entt::dispatcher &dispatcher) {

View File

@@ -1,7 +1,7 @@
#include <cr.h>
#include "../../../common/boxed_type.h"
#include "../../../common/emitter.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
switch(operation) {

View File

@@ -1,7 +1,7 @@
#include <entt/config/config.h>
#include "../../../common/boxed_type.h"
#include "../../../common/emitter.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "lib.h"
ENTT_API void emit(test::emitter &emitter) {

View File

@@ -5,7 +5,7 @@
#include <entt/meta/factory.hpp>
#include <entt/meta/meta.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "userdata.h"
test::boxed_int create_boxed_int(int value) {

View File

@@ -5,7 +5,7 @@
#include <entt/meta/factory.hpp>
#include <entt/meta/meta.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "userdata.h"
test::boxed_int create_boxed_int(int value) {

View File

@@ -7,7 +7,7 @@
#include <entt/meta/context.hpp>
#include <entt/meta/meta.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#define ASSIGN_TYPE_ID(clazz) \
template<> \

View File

@@ -5,7 +5,7 @@
#include <entt/meta/factory.hpp>
#include <entt/meta/meta.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "lib.h"
namespace {

View File

@@ -6,7 +6,7 @@
#include <entt/meta/meta.hpp>
#include <entt/meta/resolve.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "lib.h"
TEST(Meta, Shared) {

View File

@@ -7,7 +7,7 @@
#include <entt/entity/registry.hpp>
#include <entt/entity/view.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
TEST(Registry, Plugin) {
constexpr auto count = 3;

View File

@@ -3,7 +3,7 @@
#include <entt/entity/registry.hpp>
#include <entt/entity/view.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
constexpr auto count = 3;

View File

@@ -3,7 +3,7 @@
#include <entt/entity/registry.hpp>
#include <entt/entity/view.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "lib.h"
template class entt::basic_registry<entt::entity>;

View File

@@ -5,7 +5,7 @@
#include <entt/entity/registry.hpp>
#include <entt/entity/view.hpp>
#include "../../../common/boxed_type.h"
#include "../../../common/empty.h"
#include "../../../common/value_type.h"
#include "lib.h"
TEST(Registry, Shared) {

View File

@@ -3,7 +3,7 @@
#include <entt/entity/storage.hpp>
#include <entt/entity/view.hpp>
#include "../../common/empty.h"
#include "../../common/value_type.h"
using view_type = entt::basic_view<entt::get_t<entt::storage<test::empty>>, entt::exclude_t<entt::storage<test::empty>>>;