From 339b78f47c5dce9d4f8e514c441eebfac94f3aaa Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 6 Jun 2024 10:58:31 +0200 Subject: [PATCH] test: minor changes (linter) --- test/entt/core/algorithm.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/test/entt/core/algorithm.cpp b/test/entt/core/algorithm.cpp index 8287f2768..cc24300b2 100644 --- a/test/entt/core/algorithm.cpp +++ b/test/entt/core/algorithm.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -12,9 +13,7 @@ TEST(Algorithm, StdSort) { sort(arr.begin(), arr.end()); - for(std::size_t pos{}, last = arr.size() - 1u; pos < last; ++pos) { - ASSERT_LT(arr[pos], arr[pos + 1u]); - } + ASSERT_TRUE(std::is_sorted(arr.begin(), arr.end())); } TEST(Algorithm, StdSortBoxedInt) { @@ -26,9 +25,7 @@ TEST(Algorithm, StdSortBoxedInt) { return lhs.value > rhs.value; }); - for(std::size_t pos{}, last = arr.size() - 1u; pos < last; ++pos) { - ASSERT_GT(arr[pos].value, arr[pos + 1u].value); - } + ASSERT_TRUE(std::is_sorted(arr.rbegin(), arr.rend())); } TEST(Algorithm, StdSortEmptyContainer) { @@ -44,9 +41,7 @@ TEST(Algorithm, InsertionSort) { sort(arr.begin(), arr.end()); - for(std::size_t pos{}, last = arr.size() - 1u; pos < last; ++pos) { - ASSERT_LT(arr[pos], arr[pos + 1u]); - } + ASSERT_TRUE(std::is_sorted(arr.begin(), arr.end())); } TEST(Algorithm, InsertionSortBoxedInt) { @@ -57,9 +52,7 @@ TEST(Algorithm, InsertionSortBoxedInt) { return lhs.value > rhs.value; }); - for(std::size_t pos{}, last = arr.size() - 1u; pos < last; ++pos) { - ASSERT_GT(arr[pos].value, arr[pos + 1u].value); - } + ASSERT_TRUE(std::is_sorted(arr.rbegin(), arr.rend())); } TEST(Algorithm, InsertionSortEmptyContainer) { @@ -77,9 +70,7 @@ TEST(Algorithm, RadixSort) { return value; }); - for(std::size_t pos{}, last = arr.size() - 1u; pos < last; ++pos) { - ASSERT_LT(arr[pos], arr[pos + 1u]); - } + ASSERT_TRUE(std::is_sorted(arr.begin(), arr.end())); } TEST(Algorithm, RadixSortBoxedInt) { @@ -90,9 +81,7 @@ TEST(Algorithm, RadixSortBoxedInt) { return instance.value; }); - for(std::size_t pos{}, last = arr.size() - 1u; pos < last; ++pos) { - ASSERT_GT(arr[pos].value, arr[pos + 1u].value); - } + ASSERT_TRUE(std::is_sorted(arr.rbegin(), arr.rend())); } TEST(Algorithm, RadixSortEmptyContainer) {