Sfoglia il codice sorgente

test: use the mixin design a little more

skypjack 3 giorni fa
parent
commit
b7e8bb265f

+ 0 - 1
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

+ 0 - 17
test/common/non_default_constructible.h

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

+ 8 - 0
test/common/value_type.h

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

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

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

+ 0 - 1
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 {

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

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

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

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