Преглед изворни кода

test: use the mixin design a little more

skypjack пре 2 дана
родитељ
комит
3cf061201a

+ 0 - 11
test/common/empty.h

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

+ 3 - 0
test/common/value_type.h

@@ -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");

+ 0 - 1
test/entt/core/compressed_pair.cpp

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

+ 1 - 1
test/entt/core/ident.cpp

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

+ 0 - 1
test/entt/entity/component.cpp

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

+ 1 - 1
test/entt/entity/group.cpp

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

+ 1 - 1
test/entt/entity/reactive_mixin.cpp

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

+ 0 - 1
test/entt/entity/registry.cpp

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

+ 0 - 1
test/entt/entity/snapshot.cpp

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

+ 1 - 1
test/entt/entity/storage_no_instance.cpp

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

+ 0 - 1
test/entt/entity/view.cpp

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

+ 0 - 1
test/entt/meta/meta_container.cpp

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

+ 1 - 1
test/entt/meta/meta_context.cpp

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

+ 1 - 1
test/entt/meta/meta_utility.cpp

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

+ 1 - 1
test/entt/process/process.cpp

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

+ 1 - 1
test/entt/resource/resource_cache.cpp

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

+ 1 - 1
test/entt/signal/dispatcher.cpp

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

+ 1 - 1
test/entt/signal/emitter.cpp

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

+ 1 - 1
test/lib/dispatcher/plugin/plugin.cpp

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

+ 1 - 1
test/lib/dispatcher/shared/lib.cpp

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

+ 1 - 1
test/lib/emitter/plugin/plugin.cpp

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

+ 1 - 1
test/lib/emitter/shared/lib.cpp

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

+ 1 - 1
test/lib/meta/plugin/plugin.cpp

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

+ 1 - 1
test/lib/meta/plugin_std/plugin.cpp

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

+ 1 - 1
test/lib/meta/plugin_std/userdata.h

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

+ 1 - 1
test/lib/meta/shared/lib.cpp

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

+ 1 - 1
test/lib/meta/shared/main.cpp

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

+ 1 - 1
test/lib/registry/plugin/main.cpp

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

+ 1 - 1
test/lib/registry/plugin/plugin.cpp

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

+ 1 - 1
test/lib/registry/shared/lib.cpp

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

+ 1 - 1
test/lib/registry/shared/main.cpp

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

+ 1 - 1
test/lib/view/types.h

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