test: drop a bunch of NOLINT

This commit is contained in:
Michele Caini
2024-01-15 09:26:51 +01:00
parent b5ac3c5f41
commit 2562bf76f6

View File

@@ -7,51 +7,51 @@
TEST(Algorithm, StdSort) {
// well, I'm pretty sure it works, it's std::sort!!
std::array<int, 5> arr{{4, 1, 3, 2, 0}}; // NOLINT
std::array arr{4, 1, 3, 2, 0};
const entt::std_sort sort;
sort(arr.begin(), arr.end());
for(auto i = 0u; i < (arr.size() - 1u); ++i) {
ASSERT_LT(arr[i], arr[i + 1u]); // NOLINT
for(auto it = arr.begin(), last = --arr.end(); it != last; ++it) {
ASSERT_LT(*it, *(it + 1u));
}
}
TEST(Algorithm, StdSortBoxedInt) {
// well, I'm pretty sure it works, it's std::sort!!
std::array<test::boxed_int, 6> arr{{{4}, {1}, {3}, {2}, {0}, {6}}}; // NOLINT
std::array arr{test::boxed_int{4}, test::boxed_int{1}, test::boxed_int{3}, test::boxed_int{2}, test::boxed_int{0}, test::boxed_int{8}};
const entt::std_sort sort;
sort(arr.begin(), arr.end(), [](const auto &lhs, const auto &rhs) {
return lhs.value > rhs.value;
});
for(auto i = 0u; i < (arr.size() - 1u); ++i) {
ASSERT_GT(arr[i].value, arr[i + 1u].value); // NOLINT
for(auto it = arr.begin(), last = --arr.end(); it != last; ++it) {
ASSERT_GT(it->value, (it + 1u)->value);
}
}
TEST(Algorithm, InsertionSort) {
std::array<int, 5> arr{{4, 1, 3, 2, 0}}; // NOLINT
std::array arr{4, 1, 3, 2, 0};
const entt::insertion_sort sort;
sort(arr.begin(), arr.end());
for(auto i = 0u; i < (arr.size() - 1u); ++i) {
ASSERT_LT(arr[i], arr[i + 1u]); // NOLINT
for(auto it = arr.begin(), last = --arr.end(); it != last; ++it) {
ASSERT_LT(*it, *(it + 1u));
}
}
TEST(Algorithm, InsertionSortBoxedInt) {
std::array<test::boxed_int, 6> arr{{{4}, {1}, {3}, {2}, {0}, {6}}}; // NOLINT
std::array arr{test::boxed_int{4}, test::boxed_int{1}, test::boxed_int{3}, test::boxed_int{2}, test::boxed_int{0}, test::boxed_int{8}};
const entt::insertion_sort sort;
sort(arr.begin(), arr.end(), [](const auto &lhs, const auto &rhs) {
return lhs.value > rhs.value;
});
for(auto i = 0u; i < (arr.size() - 1u); ++i) {
ASSERT_GT(arr[i].value, arr[i + 1u].value); // NOLINT
for(auto it = arr.begin(), last = --arr.end(); it != last; ++it) {
ASSERT_GT(it->value, (it + 1u)->value);
}
}
@@ -63,28 +63,28 @@ TEST(Algorithm, InsertionSortEmptyContainer) {
}
TEST(Algorithm, RadixSort) {
std::array<std::uint32_t, 5> arr{{4, 1, 3, 2, 0}}; // NOLINT
std::array arr{4u, 1u, 3u, 2u, 0u};
const entt::radix_sort<8, 32> sort;
sort(arr.begin(), arr.end(), [](const auto &value) {
return value;
});
for(auto i = 0u; i < (arr.size() - 1u); ++i) {
ASSERT_LT(arr[i], arr[i + 1u]); // NOLINT
for(auto it = arr.begin(), last = --arr.end(); it != last; ++it) {
ASSERT_LT(*it, *(it + 1u));
}
}
TEST(Algorithm, RadixSortBoxedInt) {
std::array<test::boxed_int, 6> arr{{{4}, {1}, {3}, {2}, {0}, {6}}}; // NOLINT
std::array arr{test::boxed_int{4}, test::boxed_int{1}, test::boxed_int{3}, test::boxed_int{2}, test::boxed_int{0}, test::boxed_int{8}};
const entt::radix_sort<2, 6> sort;
sort(arr.rbegin(), arr.rend(), [](const auto &instance) {
return instance.value;
});
for(auto i = 0u; i < (arr.size() - 1u); ++i) {
ASSERT_GT(arr[i].value, arr[i + 1u].value); // NOLINT
for(auto it = arr.begin(), last = --arr.end(); it != last; ++it) {
ASSERT_GT(it->value, (it + 1u)->value);
}
}