Преглед на файлове

test: suppress a bunch of warnings

Michele Caini преди 5 години
родител
ревизия
52554c3972

+ 2 - 2
test/benchmark/benchmark.cpp

@@ -1050,7 +1050,7 @@ TEST(Benchmark, SortMulti) {
 
 TEST(Benchmark, AlmostSortedStdSort) {
     entt::registry registry;
-    entt::entity entities[3];
+    entt::entity entities[3]{};
 
     std::cout << "Sort 150000 entities, almost sorted, std::sort" << std::endl;
 
@@ -1080,7 +1080,7 @@ TEST(Benchmark, AlmostSortedStdSort) {
 
 TEST(Benchmark, AlmostSortedInsertionSort) {
     entt::registry registry;
-    entt::entity entities[3];
+    entt::entity entities[3]{};
 
     std::cout << "Sort 150000 entities, almost sorted, insertion sort" << std::endl;
 

+ 3 - 3
test/entt/entity/group.cpp

@@ -543,7 +543,7 @@ TEST(NonOwningGroup, EmptyTypes) {
     }
 
     registry.group(entt::get<int, char, double>).each([](const auto, int, char, double) { FAIL(); });
-    for([[maybe_unused]] auto &&curr: registry.group(entt::get<int, char, double>).proxy()) { FAIL(); }
+    ASSERT_EQ(registry.group(entt::get<int, char, double>).proxy().begin(), registry.group(entt::get<int, char, double>).proxy().end());
 }
 
 TEST(NonOwningGroup, FrontBack) {
@@ -1176,7 +1176,7 @@ TEST(OwningGroup, EmptyTypes) {
         ASSERT_EQ(entity, entt);
     }
 
-    registry.group<char>(entt::get<empty_type, int>).each([check = true](int, char) mutable {
+    registry.group<char>(entt::get<empty_type, int>).each([check = true](char, int) mutable {
         ASSERT_TRUE(check);
         check = false;
     });
@@ -1200,7 +1200,7 @@ TEST(OwningGroup, EmptyTypes) {
     }
 
     registry.group<double>(entt::get<int, char>).each([](const auto, double, int, char) { FAIL(); });
-    for([[maybe_unused]] auto &&curr: registry.group<double>(entt::get<int, char>).proxy()) { FAIL(); }
+    ASSERT_EQ(registry.group<double>(entt::get<int, char>).proxy().begin(), registry.group<double>(entt::get<int, char>).proxy().end());
 }
 
 TEST(OwningGroup, FrontBack) {

+ 1 - 1
test/entt/entity/handle.cpp

@@ -65,7 +65,7 @@ TEST(BasicHandle, Component) {
     handle.remove<char>();
 
     ASSERT_TRUE(registry.empty<char>());
-    ASSERT_EQ(0, handle.remove_if_exists<char>());
+    ASSERT_EQ(0u, handle.remove_if_exists<char>());
 
     handle.visit([](auto id) { ASSERT_EQ(entt::type_info<int>::id(), id); });
 

+ 1 - 1
test/entt/entity/snapshot.cpp

@@ -380,7 +380,7 @@ TEST(Snapshot, Continuous) {
 
     dst.view<noncopyable_component>().each([&dst, &noncopyable_component_cnt](auto, const auto &component) {
         ++noncopyable_component_cnt;
-        ASSERT_EQ(component.value, (dst.size<noncopyable_component>() - noncopyable_component_cnt - 1));
+        ASSERT_EQ(component.value, static_cast<int>(dst.size<noncopyable_component>() - noncopyable_component_cnt - 1u));
     });
 
     src.view<another_component>().each([](auto, auto &component) {

+ 3 - 3
test/entt/entity/sparse_set.cpp

@@ -16,7 +16,7 @@ TEST(SparseSet, Functionalities) {
 
     set.reserve(42);
 
-    ASSERT_EQ(set.capacity(), 42);
+    ASSERT_EQ(set.capacity(), 42u);
     ASSERT_TRUE(set.empty());
     ASSERT_EQ(set.size(), 0u);
     ASSERT_EQ(std::as_const(set).begin(), std::as_const(set).end());
@@ -76,7 +76,7 @@ TEST(SparseSet, Pagination) {
     entt::sparse_set<entt::entity> set;
     constexpr auto entt_per_page = ENTT_PAGE_SIZE / sizeof(entt::entity);
 
-    ASSERT_EQ(set.extent(), 0);
+    ASSERT_EQ(set.extent(), 0u);
 
     set.emplace(entt::entity{entt_per_page-1});
 
@@ -105,7 +105,7 @@ TEST(SparseSet, Pagination) {
 
     set.shrink_to_fit();
 
-    ASSERT_EQ(set.extent(), 0);
+    ASSERT_EQ(set.extent(), 0u);
 }
 
 TEST(SparseSet, BatchAdd) {

+ 3 - 3
test/entt/entity/storage.cpp

@@ -25,7 +25,7 @@ TEST(Storage, Functionalities) {
 
     pool.reserve(42);
 
-    ASSERT_EQ(pool.capacity(), 42);
+    ASSERT_EQ(pool.capacity(), 42u);
     ASSERT_TRUE(pool.empty());
     ASSERT_EQ(pool.size(), 0u);
     ASSERT_EQ(std::as_const(pool).begin(), std::as_const(pool).end());
@@ -69,11 +69,11 @@ TEST(Storage, Functionalities) {
     ASSERT_FALSE(pool.contains(entt::entity{0}));
     ASSERT_FALSE(pool.contains(entt::entity{41}));
 
-    ASSERT_EQ(pool.capacity(), 42);
+    ASSERT_EQ(pool.capacity(), 42u);
 
     pool.shrink_to_fit();
 
-    ASSERT_EQ(pool.capacity(), 0);
+    ASSERT_EQ(pool.capacity(), 0u);
 
     (void)entt::storage<entt::entity, int>{std::move(pool)};
     entt::storage<entt::entity, int> other;

+ 2 - 2
test/entt/entity/view.cpp

@@ -502,7 +502,7 @@ TEST(MultiComponentView, EachWithSuggestedType) {
     auto value = registry.view<int, char>().size();
 
     for(auto &&curr: registry.view<int, char>().proxy()) {
-        ASSERT_EQ(std::get<1>(curr), --value);
+        ASSERT_EQ(std::get<1>(curr), static_cast<int>(--value));
     }
 
     registry.sort<int>([](const auto lhs, const auto rhs) {
@@ -512,7 +512,7 @@ TEST(MultiComponentView, EachWithSuggestedType) {
     value = {};
 
     for(auto &&curr: registry.view<int, char>().proxy<int>()) {
-        ASSERT_EQ(std::get<1>(curr), value++);
+        ASSERT_EQ(std::get<1>(curr), static_cast<int>(value++));
     }
 }
 

+ 2 - 2
test/entt/meta/meta_data.cpp

@@ -354,7 +354,7 @@ TEST_F(MetaData, ArrayStatic) {
     ASSERT_FALSE(data.is_const());
     ASSERT_TRUE(data.is_static());
     ASSERT_TRUE(data.type().is_array());
-    ASSERT_EQ(data.type().extent(), 3);
+    ASSERT_EQ(data.type().extent(), 3u);
     ASSERT_FALSE(data.get({}));
 }
 
@@ -369,7 +369,7 @@ TEST_F(MetaData, Array) {
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_TRUE(data.type().is_array());
-    ASSERT_EQ(data.type().extent(), 5);
+    ASSERT_EQ(data.type().extent(), 5u);
     ASSERT_FALSE(data.get(instance));
 }
 

+ 2 - 2
test/lib/registry/main.cpp

@@ -21,7 +21,7 @@ TEST(Lib, Registry) {
     ASSERT_EQ(registry.size<position>(), registry.size<velocity>());
 
     registry.view<position>().each([](auto entity, auto &position) {
-        ASSERT_EQ(position.x, entt::to_integral(entity) + 16);
-        ASSERT_EQ(position.y, entt::to_integral(entity) + 16);
+        ASSERT_EQ(position.x, static_cast<int>(entt::to_integral(entity) + 16));
+        ASSERT_EQ(position.y, static_cast<int>(entt::to_integral(entity) + 16));
     });
 }

+ 2 - 2
test/lib/registry_plugin/main.cpp

@@ -31,8 +31,8 @@ TEST(Lib, Registry) {
     ASSERT_TRUE(registry.empty<tag>());
 
     registry.view<position>().each([](auto entity, auto &position) {
-        ASSERT_EQ(position.x, entt::to_integral(entity) + 16);
-        ASSERT_EQ(position.y, entt::to_integral(entity) + 16);
+        ASSERT_EQ(position.x, static_cast<int>(entt::to_integral(entity) + 16u));
+        ASSERT_EQ(position.y, static_cast<int>(entt::to_integral(entity) + 16u));
     });
 
     registry = {};