test: avoid moving trivially copyable types
This commit is contained in:
@@ -966,7 +966,7 @@ TEST(DenseMap, Indexing) {
|
||||
map[key] = 99;
|
||||
|
||||
ASSERT_TRUE(map.contains(key));
|
||||
ASSERT_EQ(map[std::move(key)], 99);
|
||||
ASSERT_EQ(map[int{key}], 99);
|
||||
ASSERT_EQ(cmap.at(key), 99); // NOLINT
|
||||
ASSERT_EQ(map.at(key), 99);
|
||||
}
|
||||
|
||||
@@ -1298,7 +1298,7 @@ TEST_F(Any, ForwardAsAny) {
|
||||
int value = 42;
|
||||
auto ref = entt::forward_as_any(value);
|
||||
auto cref = entt::forward_as_any(std::as_const(value));
|
||||
auto any = entt::forward_as_any(std::move(value));
|
||||
auto any = entt::forward_as_any(int{value});
|
||||
|
||||
ASSERT_TRUE(any);
|
||||
ASSERT_TRUE(ref);
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
#include "../common/boxed_int.h"
|
||||
|
||||
TEST(InputIteratorPointer, Functionalities) {
|
||||
test::boxed_int instance{};
|
||||
entt::input_iterator_pointer ptr{std::move(instance)};
|
||||
entt::input_iterator_pointer ptr{test::boxed_int{0}};
|
||||
|
||||
ASSERT_EQ(ptr->value, 0);
|
||||
|
||||
ptr->value = 42;
|
||||
|
||||
ASSERT_EQ(instance.value, 0); // NOLINT
|
||||
ASSERT_EQ(ptr->value, 42);
|
||||
ASSERT_EQ(ptr->value, (*ptr).value);
|
||||
ASSERT_EQ(ptr.operator->(), &ptr.operator*());
|
||||
|
||||
@@ -47,7 +47,7 @@ TEST(TypeInfo, Functionalities) {
|
||||
static_assert(std::is_copy_assignable_v<entt::type_info>, "Copy assignable type required");
|
||||
static_assert(std::is_move_assignable_v<entt::type_info>, "Move assignable type required");
|
||||
|
||||
entt::type_info info{std::in_place_type<int>};
|
||||
const entt::type_info info{std::in_place_type<int>};
|
||||
entt::type_info other{std::in_place_type<void>};
|
||||
|
||||
ASSERT_EQ(info, entt::type_info{std::in_place_type<int &>});
|
||||
@@ -67,12 +67,6 @@ TEST(TypeInfo, Functionalities) {
|
||||
ASSERT_EQ(other.index(), entt::type_index<int>::value());
|
||||
ASSERT_EQ(other.hash(), entt::type_hash<int>::value());
|
||||
ASSERT_EQ(other.name(), entt::type_name<int>::value());
|
||||
|
||||
other = std::move(info);
|
||||
|
||||
ASSERT_EQ(other.index(), entt::type_index<int>::value());
|
||||
ASSERT_EQ(other.hash(), entt::type_hash<int>::value());
|
||||
ASSERT_EQ(other.name(), entt::type_name<int>::value());
|
||||
}
|
||||
|
||||
TEST(TypeInfo, Order) {
|
||||
|
||||
@@ -1355,7 +1355,7 @@ TEST_F(MetaAny, ForwardAsMeta) {
|
||||
int value = 42;
|
||||
auto ref = entt::forward_as_meta(value);
|
||||
auto cref = entt::forward_as_meta(std::as_const(value));
|
||||
auto any = entt::forward_as_meta(std::move(value));
|
||||
auto any = entt::forward_as_meta(int{value});
|
||||
|
||||
ASSERT_TRUE(any);
|
||||
ASSERT_TRUE(ref);
|
||||
|
||||
@@ -376,8 +376,8 @@ TEST(ResourceCache, Indexing) {
|
||||
cache.load("resource"_hs, 99);
|
||||
|
||||
ASSERT_TRUE(cache.contains("resource"_hs));
|
||||
ASSERT_EQ(cache[std::move("resource"_hs)], 99);
|
||||
ASSERT_EQ(std::as_const(cache)["resource"_hs], 99);
|
||||
ASSERT_EQ(cache["resource"_hs], 99);
|
||||
}
|
||||
|
||||
TEST(ResourceCache, LoaderDispatching) {
|
||||
|
||||
Reference in New Issue
Block a user