test: internal changes to modernize the codebase
This commit is contained in:
@@ -7,16 +7,16 @@ namespace test {
|
||||
|
||||
struct aggregate {
|
||||
int value{};
|
||||
|
||||
[[nodiscard]] constexpr bool operator==(const aggregate &other) const noexcept {
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr auto operator<=>(const aggregate &other) const noexcept {
|
||||
return value <=> other.value;
|
||||
}
|
||||
};
|
||||
|
||||
[[nodiscard]] inline bool operator==(const aggregate &lhs, const aggregate &rhs) {
|
||||
return lhs.value == rhs.value;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool operator<(const aggregate &lhs, const aggregate &rhs) {
|
||||
return lhs.value < rhs.value;
|
||||
}
|
||||
|
||||
// ensure aggregate-ness :)
|
||||
static_assert(std::is_aggregate_v<test::aggregate>, "Not an aggregate type");
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ struct basic_test_allocator: std::allocator<Type> {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const basic_test_allocator &other) const {
|
||||
[[nodiscard]] bool operator==(const basic_test_allocator &other) const noexcept {
|
||||
return (this == &other);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,12 +10,11 @@ struct boxed_type {
|
||||
operator Type() const noexcept {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
inline bool operator==(const boxed_type<Type> &lhs, const boxed_type<Type> &rhs) {
|
||||
return lhs.value == rhs.value;
|
||||
}
|
||||
[[nodiscard]] bool operator==(const boxed_type &other) const noexcept {
|
||||
return value == other.value;
|
||||
}
|
||||
};
|
||||
|
||||
using boxed_int = boxed_type<int>;
|
||||
using boxed_char = boxed_type<char>;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
namespace test {
|
||||
|
||||
struct non_comparable {
|
||||
bool operator==(const non_comparable &) const = delete;
|
||||
bool operator==(const non_comparable &) const noexcept = delete;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
@@ -6,16 +6,16 @@ namespace test {
|
||||
struct pointer_stable {
|
||||
static constexpr auto in_place_delete = true;
|
||||
int value{};
|
||||
|
||||
[[nodiscard]] constexpr bool operator==(const pointer_stable &other) const noexcept {
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr auto operator<=>(const pointer_stable &other) const noexcept {
|
||||
return value <=> other.value;
|
||||
}
|
||||
};
|
||||
|
||||
[[nodiscard]] inline bool operator==(const pointer_stable &lhs, const pointer_stable &rhs) {
|
||||
return lhs.value == rhs.value;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool operator<(const pointer_stable &lhs, const pointer_stable &rhs) {
|
||||
return lhs.value < rhs.value;
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
||||
#endif
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
(*config)[entt::type_id<Other>().hash()] = len;
|
||||
}
|
||||
|
||||
bool operator==(const throwing_allocator<Type> &) const {
|
||||
[[nodiscard]] bool operator==(const throwing_allocator<Type> &) const noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@ struct throwing_type {
|
||||
return trigger;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool operator==(const throwing_type &other) const noexcept {
|
||||
return trigger == other.trigger;
|
||||
}
|
||||
|
||||
private:
|
||||
bool trigger{};
|
||||
};
|
||||
|
||||
inline bool operator==(const throwing_type &lhs, const throwing_type &rhs) {
|
||||
return lhs.throw_on_copy() == rhs.throw_on_copy();
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,10 @@ struct Registry: testing::Test {
|
||||
|
||||
struct no_eto_type {
|
||||
static constexpr std::size_t page_size = 1024u;
|
||||
|
||||
[[nodiscard]] bool operator==(const no_eto_type &other) const noexcept {
|
||||
return this == &other;
|
||||
}
|
||||
};
|
||||
|
||||
struct listener {
|
||||
@@ -85,10 +89,6 @@ struct Registry: testing::Test {
|
||||
|
||||
using RegistryDeathTest = Registry;
|
||||
|
||||
bool operator==(const Registry::no_eto_type &lhs, const Registry::no_eto_type &rhs) {
|
||||
return &lhs == &rhs;
|
||||
}
|
||||
|
||||
struct entity_traits {
|
||||
using value_type = Registry::my_entity;
|
||||
using entity_type = uint32_t;
|
||||
|
||||
Reference in New Issue
Block a user