Sfoglia il codice sorgente

test: more by the linter (work in progress)

Michele Caini 2 anni fa
parent
commit
14450df1ee

+ 1 - 1
test/entt/container/dense_map.cpp

@@ -967,7 +967,7 @@ TEST(DenseMap, Indexing) {
 
     ASSERT_TRUE(map.contains(key));
     ASSERT_EQ(map[std::move(key)], 99);
-    ASSERT_EQ(cmap.at(key), 99);
+    ASSERT_EQ(cmap.at(key), 99); // NOLINT
     ASSERT_EQ(map.at(key), 99);
 }
 

+ 14 - 14
test/entt/core/any.cpp

@@ -216,7 +216,7 @@ TEST_F(Any, SBOMoveConstruction) {
     entt::any any{42};
     entt::any other{std::move(any)};
 
-    ASSERT_TRUE(any);
+    ASSERT_TRUE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_EQ(any.policy(), entt::any_policy::owner); // NOLINT
     ASSERT_EQ(other.policy(), entt::any_policy::owner);
@@ -233,7 +233,7 @@ TEST_F(Any, SBOMoveAssignment) {
 
     other = std::move(any);
 
-    ASSERT_TRUE(any);
+    ASSERT_TRUE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_EQ(any.policy(), entt::any_policy::owner); // NOLINT
     ASSERT_EQ(other.policy(), entt::any_policy::owner);
@@ -475,7 +475,7 @@ TEST_F(Any, NoSBOMoveConstruction) {
     entt::any any{instance};
     entt::any other{std::move(any)};
 
-    ASSERT_TRUE(any);
+    ASSERT_TRUE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_EQ(any.policy(), entt::any_policy::owner); // NOLINT
     ASSERT_EQ(other.policy(), entt::any_policy::owner);
@@ -493,7 +493,7 @@ TEST_F(Any, NoSBOMoveAssignment) {
 
     other = std::move(any);
 
-    ASSERT_TRUE(any);
+    ASSERT_TRUE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_EQ(any.policy(), entt::any_policy::owner); // NOLINT
     ASSERT_EQ(other.policy(), entt::any_policy::owner);
@@ -665,7 +665,7 @@ TEST_F(Any, VoidMoveConstruction) {
     entt::any any{std::in_place_type<void>};
     entt::any other{std::move(any)};
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_FALSE(other);
     ASSERT_EQ(any.policy(), entt::any_policy::owner); // NOLINT
     ASSERT_EQ(other.policy(), entt::any_policy::owner);
@@ -681,7 +681,7 @@ TEST_F(Any, VoidMoveAssignment) {
 
     other = std::move(any);
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_FALSE(other);
     ASSERT_EQ(any.policy(), entt::any_policy::owner); // NOLINT
     ASSERT_EQ(other.policy(), entt::any_policy::owner);
@@ -696,8 +696,8 @@ TEST_F(Any, SBOMoveValidButUnspecifiedState) {
     entt::any other{std::move(any)};
     const entt::any valid = std::move(other);
 
-    ASSERT_TRUE(any);
-    ASSERT_TRUE(other);
+    ASSERT_TRUE(any);   // NOLINT
+    ASSERT_TRUE(other); // NOLINT
     ASSERT_TRUE(valid);
 }
 
@@ -707,8 +707,8 @@ TEST_F(Any, NoSBOMoveValidButUnspecifiedState) {
     entt::any other{std::move(any)};
     const entt::any valid = std::move(other);
 
-    ASSERT_TRUE(any);
-    ASSERT_TRUE(other);
+    ASSERT_TRUE(any);   // NOLINT
+    ASSERT_TRUE(other); // NOLINT
     ASSERT_TRUE(valid);
 }
 
@@ -717,8 +717,8 @@ TEST_F(Any, VoidMoveValidButUnspecifiedState) {
     entt::any other{std::move(any)};
     const entt::any valid = std::move(other);
 
-    ASSERT_FALSE(any);
-    ASSERT_FALSE(other);
+    ASSERT_FALSE(any);   // NOLINT
+    ASSERT_FALSE(other); // NOLINT
     ASSERT_FALSE(valid);
 }
 
@@ -1423,7 +1423,7 @@ TEST_F(Any, CopyMoveReference) {
     entt::any move = std::move(any);
     entt::any copy = move;
 
-    ASSERT_TRUE(any);
+    ASSERT_TRUE(any); // NOLINT
     ASSERT_TRUE(move);
     ASSERT_TRUE(copy);
 
@@ -1452,7 +1452,7 @@ TEST_F(Any, CopyMoveConstReference) {
     entt::any move = std::move(any);
     entt::any copy = move;
 
-    ASSERT_TRUE(any);
+    ASSERT_TRUE(any); // NOLINT
     ASSERT_TRUE(move);
     ASSERT_TRUE(copy);
 

+ 1 - 1
test/entt/core/iterator.cpp

@@ -10,7 +10,7 @@ TEST(InputIteratorPointer, Functionalities) {
     entt::input_iterator_pointer ptr{std::move(instance)};
     ptr->value = 42;
 
-    ASSERT_EQ(instance.value, 0);
+    ASSERT_EQ(instance.value, 0); // NOLINT
     ASSERT_EQ(ptr->value, 42);
     ASSERT_EQ(ptr->value, (*ptr).value);
     ASSERT_EQ(ptr.operator->(), &ptr.operator*());

+ 2 - 1
test/entt/entity/registry.cpp

@@ -13,6 +13,7 @@
 #include <entt/core/type_info.hpp>
 #include <entt/entity/entity.hpp>
 #include <entt/entity/registry.hpp>
+#include <entt/entity/view.hpp>
 #include "../common/aggregate.h"
 #include "../common/config.h"
 #include "../common/custom_entity.h"
@@ -873,7 +874,7 @@ TEST(Registry, View) {
     ASSERT_EQ(std::distance(fview.begin(), fview.end()), 1);
 
     mview.each([&entity, first = true](auto entt, auto &&...) mutable {
-        ASSERT_EQ(entt, entity[2u * first]);
+        ASSERT_EQ(entt, entity[2u * first]); // NOLINT
         first = false;
     });
 

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

@@ -90,7 +90,7 @@ TYPED_TEST(RuntimeView, Constructors) {
     const runtime_view_type other{std::move(temp), view.get_allocator()};
 
     ASSERT_TRUE(view.contains(entity));
-    ASSERT_FALSE(temp.contains(entity));
+    ASSERT_FALSE(temp.contains(entity)); // NOLINT
     ASSERT_TRUE(other.contains(entity));
 }
 

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

@@ -999,7 +999,7 @@ TEST(MultiComponentView, EachWithHoles) {
 
     auto view = registry.view<char, int>();
 
-    view.each([e0](auto entity, const char &c, const int &i) {
+    view.each([e0](auto entity, const char &c, const int &i) { // NOLINT
         ASSERT_EQ(entity, e0);
         ASSERT_EQ(c, '0');
         ASSERT_EQ(i, 0);

+ 1 - 1
test/entt/graph/adjacency_matrix.cpp

@@ -33,7 +33,7 @@ TEST(AdjacencyMatrix, Constructors) {
     const entt::adjacency_matrix<entt::directed_tag> temp{adjacency_matrix, adjacency_matrix.get_allocator()};
     const entt::adjacency_matrix<entt::directed_tag> other{std::move(adjacency_matrix), adjacency_matrix.get_allocator()};
 
-    ASSERT_EQ(adjacency_matrix.size(), 0u);
+    ASSERT_EQ(adjacency_matrix.size(), 0u); // NOLINT
     ASSERT_EQ(other.size(), 3u);
 
     ASSERT_FALSE(adjacency_matrix.contains(0u, 1u));

+ 12 - 12
test/entt/meta/meta_any.cpp

@@ -270,7 +270,7 @@ TEST_F(MetaAny, SBOMoveConstruction) {
     entt::meta_any any{42};
     entt::meta_any other{std::move(any)};
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_FALSE(other.try_cast<std::size_t>());
     ASSERT_EQ(other.cast<int>(), 42);
@@ -284,7 +284,7 @@ TEST_F(MetaAny, SBOMoveAssignment) {
 
     other = std::move(any);
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_FALSE(other.try_cast<std::size_t>());
     ASSERT_EQ(other.cast<int>(), 42);
@@ -540,7 +540,7 @@ TEST_F(MetaAny, NoSBOMoveConstruction) {
     entt::meta_any any{instance};
     entt::meta_any other{std::move(any)};
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_FALSE(other.try_cast<std::size_t>());
     ASSERT_EQ(other.cast<fat_t>(), instance);
@@ -555,7 +555,7 @@ TEST_F(MetaAny, NoSBOMoveAssignment) {
 
     other = std::move(any);
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_FALSE(other.try_cast<std::size_t>());
     ASSERT_EQ(other.cast<fat_t>(), instance);
@@ -743,7 +743,7 @@ TEST_F(MetaAny, VoidMoveConstruction) {
     entt::meta_any any{std::in_place_type<void>};
     const entt::meta_any other{std::move(any)};
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_EQ(other.type(), entt::resolve<void>());
     ASSERT_EQ(other, entt::meta_any{std::in_place_type<void>});
@@ -755,7 +755,7 @@ TEST_F(MetaAny, VoidMoveAssignment) {
 
     other = std::move(any);
 
-    ASSERT_FALSE(any);
+    ASSERT_FALSE(any); // NOLINT
     ASSERT_TRUE(other);
     ASSERT_EQ(other.type(), entt::resolve<void>());
     ASSERT_EQ(other, entt::meta_any{std::in_place_type<void>});
@@ -766,8 +766,8 @@ TEST_F(MetaAny, SBOMoveInvalidate) {
     entt::meta_any other{std::move(any)};
     const entt::meta_any valid = std::move(other);
 
-    ASSERT_FALSE(any);
-    ASSERT_FALSE(other);
+    ASSERT_FALSE(any);   // NOLINT
+    ASSERT_FALSE(other); // NOLINT
     ASSERT_TRUE(valid);
 }
 
@@ -777,8 +777,8 @@ TEST_F(MetaAny, NoSBOMoveInvalidate) {
     entt::meta_any other{std::move(any)};
     const entt::meta_any valid = std::move(other);
 
-    ASSERT_FALSE(any);
-    ASSERT_FALSE(other);
+    ASSERT_FALSE(any);   // NOLINT
+    ASSERT_FALSE(other); // NOLINT
     ASSERT_TRUE(valid);
 }
 
@@ -787,8 +787,8 @@ TEST_F(MetaAny, VoidMoveInvalidate) {
     entt::meta_any other{std::move(any)};
     const entt::meta_any valid = std::move(other);
 
-    ASSERT_FALSE(any);
-    ASSERT_FALSE(other);
+    ASSERT_FALSE(any);   // NOLINT
+    ASSERT_FALSE(other); // NOLINT
     ASSERT_TRUE(valid);
 }
 

+ 1 - 1
test/entt/meta/meta_context.cpp

@@ -33,7 +33,7 @@ struct clazz: base {
         : base{},
           value{v} {}
 
-    clazz(char c, int v)
+    clazz(char c, int v) // NOLINT
         : base{c},
           value{v} {}
 

+ 1 - 1
test/entt/meta/meta_func.cpp

@@ -53,7 +53,7 @@ struct func_t {
         return f(a, b);
     }
 
-    [[nodiscard]] int f(int a, int b) {
+    [[nodiscard]] int f(int a, int b) { // NOLINT
         value = a;
         return b * b;
     }

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

@@ -82,7 +82,7 @@ struct overloaded_func_t {
         return f(a, b);
     }
 
-    [[nodiscard]] int f(int a, int b) {
+    [[nodiscard]] int f(int a, int b) { // NOLINT
         value = a;
         return g(b);
     }
@@ -95,7 +95,7 @@ struct overloaded_func_t {
         return g(v);
     }
 
-    [[nodiscard]] float f(int a, float b) {
+    [[nodiscard]] float f(int a, float b) { // NOLINT
         value = a;
         return static_cast<float>(e(static_cast<int>(b)));
     }

+ 1 - 1
test/entt/poly/poly.cpp

@@ -221,7 +221,7 @@ TYPED_TEST(Poly, Functionalities) {
     poly_type move = std::move(copy);
 
     ASSERT_TRUE(move);
-    ASSERT_TRUE(copy);
+    ASSERT_TRUE(copy); // NOLINT
     ASSERT_EQ(move->get(), 3);
 
     move.reset();

+ 2 - 2
test/entt/resource/resource.cpp

@@ -87,7 +87,7 @@ TEST(Resource, ConstNonConstAndAllInBetween) {
     entt::resource<const derived> move{std::move(other)};
 
     ASSERT_TRUE(resource);
-    ASSERT_FALSE(other);
+    ASSERT_FALSE(other); // NOLINT
 
     ASSERT_TRUE(copy);
     ASSERT_EQ(copy, resource);
@@ -102,7 +102,7 @@ TEST(Resource, ConstNonConstAndAllInBetween) {
     copy = resource;
     move = std::move(resource);
 
-    ASSERT_FALSE(resource);
+    ASSERT_FALSE(resource); // NOLINT
     ASSERT_FALSE(other);
 
     ASSERT_TRUE(copy);

+ 3 - 3
test/entt/signal/emitter.cpp

@@ -26,13 +26,13 @@ TEST(Emitter, Move) {
 
     ASSERT_FALSE(other.empty());
     ASSERT_TRUE(other.contains<foo_event>());
-    ASSERT_TRUE(emitter.empty());
+    ASSERT_TRUE(emitter.empty()); // NOLINT
 
     emitter = std::move(other);
 
     ASSERT_FALSE(emitter.empty());
     ASSERT_TRUE(emitter.contains<foo_event>());
-    ASSERT_TRUE(other.empty());
+    ASSERT_TRUE(other.empty()); // NOLINT
 }
 
 TEST(Emitter, Swap) {
@@ -166,6 +166,6 @@ TEST(Emitter, CustomAllocator) {
     emitter.on<foo_event>([](auto &, const auto &) {});
     const decltype(emitter) other{std::move(emitter), allocator};
 
-    ASSERT_TRUE(emitter.empty());
+    ASSERT_TRUE(emitter.empty()); // NOLINT
     ASSERT_FALSE(other.empty());
 }

+ 3 - 3
test/entt/signal/sigh.cpp

@@ -303,7 +303,7 @@ TEST(SigH, ScopedConnectionMove) {
         const entt::scoped_connection inner{std::move(outer)};
 
         ASSERT_FALSE(listener.k);
-        ASSERT_FALSE(outer);
+        ASSERT_FALSE(outer); // NOLINT
         ASSERT_TRUE(inner);
 
         sigh.publish(42);
@@ -327,7 +327,7 @@ TEST(SigH, ScopedConnectionMove) {
 
         inner = std::move(outer);
 
-        ASSERT_FALSE(outer);
+        ASSERT_FALSE(outer); // NOLINT
         ASSERT_TRUE(inner);
 
         sigh.publish(42);
@@ -479,7 +479,7 @@ TEST(SigH, CustomAllocator) {
 
     decltype(sigh) move{std::move(copy), allocator};
 
-    ASSERT_TRUE(copy.empty());
+    ASSERT_TRUE(copy.empty()); // NOLINT
     ASSERT_FALSE(move.empty());
 
     sink = entt::sink{move};

+ 1 - 1
test/lib/meta/shared/lib.cpp

@@ -10,7 +10,7 @@ position create_position(int x, int y) {
     return position{x, y};
 }
 
-ENTT_API void share(entt::locator<entt::meta_ctx>::node_type handle) {
+ENTT_API void share(const entt::locator<entt::meta_ctx>::node_type &handle) {
     entt::locator<entt::meta_ctx>::reset(handle);
 }
 

+ 1 - 1
test/lib/meta/shared/main.cpp

@@ -8,7 +8,7 @@
 #include <entt/meta/resolve.hpp>
 #include "../common/types.h"
 
-ENTT_API void share(entt::locator<entt::meta_ctx>::node_type);
+ENTT_API void share(const entt::locator<entt::meta_ctx>::node_type &);
 ENTT_API void set_up();
 ENTT_API void tear_down();
 ENTT_API entt::meta_any wrap_int(int);