From 2562bf76f611d1cf541cc8b2fd5696991697ce7c Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 15 Jan 2024 09:26:51 +0100 Subject: [PATCH] test: drop a bunch of NOLINT --- test/entt/core/algorithm.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/entt/core/algorithm.cpp b/test/entt/core/algorithm.cpp index 3c0f3ea19..04ca1fbbc 100644 --- a/test/entt/core/algorithm.cpp +++ b/test/entt/core/algorithm.cpp @@ -7,51 +7,51 @@ TEST(Algorithm, StdSort) { // well, I'm pretty sure it works, it's std::sort!! - std::array 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 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 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 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 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 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); } }