test: drop a bunch of NOLINT

This commit is contained in:
Michele Caini
2024-01-31 10:25:20 +01:00
parent 97b2b6c5b8
commit 11d609314c
4 changed files with 17 additions and 10 deletions

View File

@@ -47,14 +47,14 @@ TEST(CompressedPair, ConstructCopyMove) {
entt::compressed_pair<test::empty, std::unique_ptr<int>> movable{test::empty{}, std::make_unique<int>(1)};
auto by_move{std::move(movable)};
ASSERT_TRUE(by_move.second());
ASSERT_EQ(*by_move.second(), 1);
ASSERT_EQ(movable.second(), nullptr); // NOLINT
*by_move.second() = 3;
movable = std::move(by_move);
ASSERT_TRUE(movable.second());
ASSERT_EQ(*movable.second(), 3);
ASSERT_EQ(by_move.second(), nullptr); // NOLINT
}
TEST(CompressedPair, PiecewiseConstruct) {

View File

@@ -1,3 +1,4 @@
#include <array>
#include <cmath>
#include <cstddef>
#include <limits>
@@ -214,10 +215,11 @@ TEST(MakeObjUsingAllocator, Functionalities) {
}
TEST(UninitializedConstructUsingAllocator, NoUsesAllocatorConstruction) {
alignas(int) std::byte storage[sizeof(int)]; // NOLINT
alignas(int) std::array<std::byte, sizeof(int)> storage{};
const std::allocator<int> allocator{};
int *value = entt::uninitialized_construct_using_allocator(reinterpret_cast<int *>(&storage), allocator, 1); // NOLINT
// NOLINTNEXTLINE(*-reinterpret-cast)
int *value = entt::uninitialized_construct_using_allocator(reinterpret_cast<int *>(storage.data()), allocator, 1);
ASSERT_EQ(*value, 1);
}
@@ -230,9 +232,10 @@ TEST(UninitializedConstructUsingAllocator, UsesAllocatorConstruction) {
test::tracked_memory_resource memory_resource{};
const std::pmr::polymorphic_allocator<string_type> allocator{&memory_resource};
alignas(string_type) std::byte storage[sizeof(string_type)]; // NOLINT
alignas(string_type) std::array<std::byte, sizeof(string_type)> storage{};
string_type *value = entt::uninitialized_construct_using_allocator(reinterpret_cast<string_type *>(&storage), allocator, test::tracked_memory_resource::default_value); // NOLINT
// NOLINTNEXTLINE(*-reinterpret-cast)
string_type *value = entt::uninitialized_construct_using_allocator(reinterpret_cast<string_type *>(storage.data()), allocator, test::tracked_memory_resource::default_value);
ASSERT_GT(memory_resource.do_allocate_counter(), 0u);
ASSERT_EQ(memory_resource.do_deallocate_counter(), 0u);

View File

@@ -60,8 +60,10 @@ struct UnpackAsValue: ::testing::Test {
TEST(SizeOf, Functionalities) {
ASSERT_EQ(entt::size_of_v<void>, 0u);
ASSERT_EQ(entt::size_of_v<char>, sizeof(char));
ASSERT_EQ(entt::size_of_v<int[]>, 0u); // NOLINT
ASSERT_EQ(entt::size_of_v<int[3]>, sizeof(int[3])); // NOLINT
// NOLINTBEGIN(*-avoid-c-arrays)
ASSERT_EQ(entt::size_of_v<int[]>, 0u);
ASSERT_EQ(entt::size_of_v<int[3]>, sizeof(int[3]));
// NOLINTEND(*-avoid-c-arrays)
}
TEST_F(UnpackAsType, Functionalities) {
@@ -223,7 +225,8 @@ TEST(IsEqualityComparable, Functionalities) {
ASSERT_TRUE((entt::is_equality_comparable_v<std::optional<int>>));
ASSERT_TRUE(entt::is_equality_comparable_v<nlohmann_json_like>);
ASSERT_FALSE(entt::is_equality_comparable_v<int[3u]>); // NOLINT
// NOLINTNEXTLINE(*-avoid-c-arrays)
ASSERT_FALSE(entt::is_equality_comparable_v<int[3u]>);
ASSERT_FALSE(entt::is_equality_comparable_v<test::non_comparable>);
ASSERT_FALSE(entt::is_equality_comparable_v<const test::non_comparable>);
ASSERT_FALSE(entt::is_equality_comparable_v<std::vector<test::non_comparable>>);

View File

@@ -27,7 +27,8 @@ TEST(Overload, Functionalities) {
ASSERT_EQ(entt::overload<void(int)>(&functions::bar), static_cast<void (functions::*)(int)>(&functions::bar));
ASSERT_EQ(entt::overload<void()>(&functions::bar), static_cast<void (functions::*)()>(&functions::bar));
functions instance; // NOLINT
functions instance;
instance.bar(0); // makes the linter happy
ASSERT_NO_THROW(entt::overload<void(int)>(&functions::foo)(0));
ASSERT_NO_THROW(entt::overload<void()>(&functions::foo)());