test: prepare for refactoring

This commit is contained in:
skypjack
2025-12-22 11:33:00 +01:00
parent ebb9cf017a
commit b157dfbf86
7 changed files with 22 additions and 17 deletions

View File

@@ -14,7 +14,7 @@ struct BasicHashedString: ::testing::Test {
using HashedString = BasicHashedString;
using HashedWString = BasicHashedString;
TEST_F(BasicHashedString, DeductionGuide) {
TEST_F(HashedString, DeductionGuide) {
testing::StaticAssertTypeEq<decltype(entt::basic_hashed_string{"foo"}), entt::hashed_string>();
testing::StaticAssertTypeEq<decltype(entt::basic_hashed_string{L"foo"}), entt::hashed_wstring>();
}
@@ -123,6 +123,11 @@ TEST_F(HashedString, Constexprness) {
ASSERT_GE(entt::hashed_string{"foo"}, "foo"_hs);
}
TEST_F(HashedWString, DeductionGuide) {
testing::StaticAssertTypeEq<decltype(entt::basic_hashed_string{"foo"}), entt::hashed_string>();
testing::StaticAssertTypeEq<decltype(entt::basic_hashed_string{L"foo"}), entt::hashed_wstring>();
}
TEST_F(HashedWString, Functionalities) {
using namespace entt::literals;
using hash_type = entt::hashed_wstring::hash_type;

View File

@@ -27,7 +27,7 @@ TEST(Ident, Uniqueness) {
}
}
TEST(Identifier, SingleType) {
TEST(Ident, SingleType) {
using id = entt::ident<test::empty>;
[[maybe_unused]] const std::integral_constant<id::value_type, id::value<test::empty>> ic;
}

View File

@@ -5,7 +5,7 @@
#include <entt/core/iterator.hpp>
#include "../../common/boxed_type.h"
TEST(InputIteratorPointer, Functionalities) {
TEST(Iterator, InputIteratorPointer) {
entt::input_iterator_pointer ptr{test::boxed_int{0}};
ASSERT_EQ(ptr->value, 0);
@@ -17,7 +17,7 @@ TEST(InputIteratorPointer, Functionalities) {
ASSERT_EQ(ptr.operator->(), &ptr.operator*());
}
TEST(IotaIterator, Functionalities) {
TEST(Iterator, IotaIterator) {
entt::iota_iterator<std::size_t> first{};
const entt::iota_iterator<std::size_t> last{2u};
@@ -31,7 +31,7 @@ TEST(IotaIterator, Functionalities) {
ASSERT_EQ(*first, 2u);
}
TEST(IterableAdaptor, Functionalities) {
TEST(Iterator, IterableAdaptor) {
std::vector<int> vec{1, 2};
entt::iterable_adaptor iterable{vec.begin(), vec.end()};
decltype(iterable) other{};

View File

@@ -10,7 +10,7 @@ struct functions {
void bar() {}
};
TEST(Overload, Functionalities) {
TEST(Utility, Overload) {
ASSERT_EQ(entt::overload<void(int)>(&functions::foo), static_cast<void (*)(int)>(&functions::foo));
ASSERT_EQ(entt::overload<void()>(&functions::foo), static_cast<void (*)()>(&functions::foo));
@@ -27,7 +27,7 @@ TEST(Overload, Functionalities) {
ASSERT_NO_THROW((instance.*entt::overload<void()>(&functions::bar))());
}
TEST(Overloaded, Functionalities) {
TEST(Utility, Overloaded) {
int iv = 0;
char cv = '\0';
@@ -42,7 +42,7 @@ TEST(Overloaded, Functionalities) {
ASSERT_EQ(cv, 'c');
}
TEST(YCombinator, Functionalities) {
TEST(Utility, YCombinator) {
entt::y_combinator gauss([](const auto &self, auto value) -> unsigned int {
return value ? (value + self(value - 1u)) : 0;
});

View File

@@ -20,22 +20,22 @@ private:
int value;
};
struct ServiceLocator: ::testing::Test {
struct Locator: ::testing::Test {
void SetUp() override {
entt::locator<base_service>::reset();
}
};
using ServiceLocatorDeathTest = ServiceLocator;
using LocatorDeathTest = Locator;
TEST_F(ServiceLocator, ValueAndTheLike) {
TEST_F(Locator, ValueAndTheLike) {
ASSERT_FALSE(entt::locator<base_service>::has_value());
ASSERT_EQ(entt::locator<base_service>::value_or<derived_service>(1).invoke(3), 4);
ASSERT_TRUE(entt::locator<base_service>::has_value());
ASSERT_EQ(entt::locator<base_service>::value().invoke(9), 10);
}
TEST_F(ServiceLocator, Emplace) {
TEST_F(Locator, Emplace) {
ASSERT_FALSE(entt::locator<base_service>::has_value());
ASSERT_EQ(entt::locator<base_service>::emplace<derived_service>(5).invoke(1), 6);
ASSERT_TRUE(entt::locator<base_service>::has_value());
@@ -49,7 +49,7 @@ TEST_F(ServiceLocator, Emplace) {
ASSERT_EQ(entt::locator<base_service>::value().invoke(3), 8);
}
TEST_F(ServiceLocator, ResetHandle) {
TEST_F(Locator, ResetHandle) {
entt::locator<base_service>::emplace<derived_service>(1);
auto handle = entt::locator<base_service>::handle();
@@ -66,7 +66,7 @@ TEST_F(ServiceLocator, ResetHandle) {
ASSERT_EQ(entt::locator<base_service>::value().invoke(3), 4);
}
TEST_F(ServiceLocator, ElementWithDeleter) {
TEST_F(Locator, ElementWithDeleter) {
derived_service service{1};
entt::locator<base_service>::reset(&service, [&service](base_service *serv) {
ASSERT_EQ(serv, &service);
@@ -81,7 +81,7 @@ TEST_F(ServiceLocator, ElementWithDeleter) {
ASSERT_EQ(service.invoke(1), 3);
}
ENTT_DEBUG_TEST_F(ServiceLocatorDeathTest, UninitializedValue) {
ENTT_DEBUG_TEST_F(LocatorDeathTest, UninitializedValue) {
ASSERT_EQ(entt::locator<base_service>::value_or<derived_service>(1).invoke(1), 2);
entt::locator<base_service>::reset();

View File

@@ -3,7 +3,7 @@
#include <entt/core/type_traits.hpp>
#include <entt/stl/functional.hpp>
TEST(Identity, Functionalities) {
TEST(Functional, Identity) {
const entt::stl::identity identity;
int value = 2;

View File

@@ -2,7 +2,7 @@
#include <gtest/gtest.h>
#include <entt/stl/memory.hpp>
TEST(ToAddress, Functionalities) {
TEST(Memory, ToAddress) {
const std::shared_ptr<int> shared = std::make_shared<int>();
auto *plain = &*shared;