|
|
@@ -34,20 +34,20 @@ TEST(CompressedPair, ConstructCopyMove) {
|
|
|
static_assert(std::is_move_constructible_v<entt::compressed_pair<std::unique_ptr<int>, test::empty>>, "Move constructible type required");
|
|
|
static_assert(std::is_move_assignable_v<entt::compressed_pair<std::unique_ptr<int>, test::empty>>, "Move assignable type required");
|
|
|
|
|
|
- entt::compressed_pair copyable{test::non_default_constructible{42}, test::empty{}}; // NOLINT
|
|
|
+ entt::compressed_pair copyable{test::non_default_constructible{2}, test::empty{}};
|
|
|
auto by_copy{copyable};
|
|
|
|
|
|
- ASSERT_EQ(by_copy.first().value, 42);
|
|
|
+ ASSERT_EQ(by_copy.first().value, 2);
|
|
|
|
|
|
by_copy.first().value = 3;
|
|
|
copyable = by_copy;
|
|
|
|
|
|
ASSERT_EQ(copyable.first().value, 3);
|
|
|
|
|
|
- entt::compressed_pair<test::empty, std::unique_ptr<int>> movable{test::empty{}, std::make_unique<int>(99)}; // NOLINT
|
|
|
+ entt::compressed_pair<test::empty, std::unique_ptr<int>> movable{test::empty{}, std::make_unique<int>(1)};
|
|
|
auto by_move{std::move(movable)};
|
|
|
|
|
|
- ASSERT_EQ(*by_move.second(), 99);
|
|
|
+ ASSERT_EQ(*by_move.second(), 1);
|
|
|
ASSERT_EQ(movable.second(), nullptr); // NOLINT
|
|
|
|
|
|
*by_move.second() = 3;
|
|
|
@@ -59,21 +59,21 @@ TEST(CompressedPair, ConstructCopyMove) {
|
|
|
|
|
|
TEST(CompressedPair, PiecewiseConstruct) {
|
|
|
const entt::compressed_pair<test::empty, test::empty> empty{std::piecewise_construct, std::make_tuple(), std::make_tuple()};
|
|
|
- const entt::compressed_pair<std::vector<int>, std::size_t> pair{std::piecewise_construct, std::forward_as_tuple(std::vector<int>{42}), std::make_tuple(sizeof(empty))};
|
|
|
+ const entt::compressed_pair<std::vector<int>, std::size_t> pair{std::piecewise_construct, std::forward_as_tuple(std::vector<int>{2}), std::make_tuple(sizeof(empty))};
|
|
|
|
|
|
ASSERT_EQ(pair.first().size(), 1u);
|
|
|
ASSERT_EQ(pair.second(), sizeof(empty));
|
|
|
}
|
|
|
|
|
|
TEST(CompressedPair, DeductionGuide) {
|
|
|
- const int value = 42;
|
|
|
+ const int value = 2;
|
|
|
const test::empty empty{};
|
|
|
entt::compressed_pair pair{value, 3};
|
|
|
|
|
|
testing::StaticAssertTypeEq<decltype(entt::compressed_pair{test::empty{}, empty}), entt::compressed_pair<test::empty, test::empty>>();
|
|
|
testing::StaticAssertTypeEq<decltype(pair), entt::compressed_pair<int, int>>();
|
|
|
|
|
|
- ASSERT_EQ(pair.first(), 42);
|
|
|
+ ASSERT_EQ(pair.first(), 2);
|
|
|
ASSERT_EQ(pair.second(), 3);
|
|
|
}
|
|
|
|
|
|
@@ -138,10 +138,10 @@ TEST(CompressedPair, Get) {
|
|
|
testing::StaticAssertTypeEq<decltype(cfirst), const int>();
|
|
|
testing::StaticAssertTypeEq<decltype(csecond), const int>();
|
|
|
|
|
|
- auto [tfirst, tsecond] = entt::compressed_pair{9, 99}; // NOLINT
|
|
|
+ auto [tfirst, tsecond] = entt::compressed_pair{32, 64};
|
|
|
|
|
|
- ASSERT_EQ(tfirst, 9);
|
|
|
- ASSERT_EQ(tsecond, 99);
|
|
|
+ ASSERT_EQ(tfirst, 32);
|
|
|
+ ASSERT_EQ(tsecond, 64);
|
|
|
|
|
|
testing::StaticAssertTypeEq<decltype(cfirst), const int>();
|
|
|
testing::StaticAssertTypeEq<decltype(csecond), const int>();
|