test: boxed_int -> boxed_type

This commit is contained in:
Michele Caini
2024-01-22 09:49:59 +01:00
parent baab46e77b
commit 5f73b2e4f2
8 changed files with 25 additions and 22 deletions

1
TODO
View File

@@ -27,6 +27,5 @@ TODO:
* review assure conflicts check, hash doesn't fit the purpose maybe
* allow to zero-sized versions (with non-regression tests)
* auto type info data from types if present
* boxed_int -> boxed_type with known specializations
* sparse set sort_as should return the length to be a proper drop-in replacement for pack (then review registry destroy)
* group review: use handler as base with protected members and arrays of common type (see view for further details)

View File

@@ -1,16 +0,0 @@
#ifndef ENTT_COMMON_BOXED_INT_H
#define ENTT_COMMON_BOXED_INT_H
namespace test {
struct boxed_int {
int value{};
};
inline bool operator==(const boxed_int &lhs, const boxed_int &rhs) {
return lhs.value == rhs.value;
}
} // namespace test
#endif

View File

@@ -0,0 +1,20 @@
#ifndef ENTT_COMMON_BOXED_TYPE_H
#define ENTT_COMMON_BOXED_TYPE_H
namespace test {
template<typename Type>
struct boxed_type {
Type value{};
};
template<typename Type>
inline bool operator==(const boxed_type<Type> &lhs, const boxed_type<Type> &rhs) {
return lhs.value == rhs.value;
}
using boxed_int = boxed_type<int>;
} // namespace test
#endif

View File

@@ -3,7 +3,7 @@
#include <vector>
#include <gtest/gtest.h>
#include <entt/core/algorithm.hpp>
#include "../common/boxed_int.h"
#include "../common/boxed_type.h"
TEST(Algorithm, StdSort) {
// well, I'm pretty sure it works, it's std::sort!!

View File

@@ -3,7 +3,7 @@
#include <vector>
#include <gtest/gtest.h>
#include <entt/core/iterator.hpp>
#include "../common/boxed_int.h"
#include "../common/boxed_type.h"
TEST(InputIteratorPointer, Functionalities) {
entt::input_iterator_pointer ptr{test::boxed_int{0}};

View File

@@ -1,7 +1,7 @@
#include <gtest/gtest.h>
#include <entt/config/config.h>
#include <entt/entity/component.hpp>
#include "../common/boxed_int.h"
#include "../common/boxed_type.h"
#include "../common/empty.h"
#include "../common/non_movable.h"

View File

@@ -9,7 +9,7 @@
#include <gtest/gtest.h>
#include <entt/entity/group.hpp>
#include <entt/entity/registry.hpp>
#include "../common/boxed_int.h"
#include "../common/boxed_type.h"
#include "../common/config.h"
#include "../common/empty.h"

View File

@@ -11,7 +11,7 @@
#include <entt/entity/entity.hpp>
#include <entt/entity/registry.hpp>
#include <entt/entity/view.hpp>
#include "../common/boxed_int.h"
#include "../common/boxed_type.h"
#include "../common/empty.h"
#include "../common/pointer_stable.h"