based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commit6d963dc3ee3ead3a15127e5a51503d41f63a3d51
parentd0cad211ce8712dd5488edf4a8b5279d1b3860db
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateSun, 6 Apr 2025 19:30:15 +0200

Test use const std::array, because they can

Diffstat:
Mtest/source/count_if_test.cpp|++++++++--------
Mtest/source/count_test.cpp|++++++++--------
Mtest/source/find_if_test.cpp|++++++++++++++++++++--------------------
Mtest/source/find_test.cpp|++++++++--------
Mtest/source/for_each_test.cpp|++++----
Mtest/source/max_element_test.cpp|+++++++++++-----------
Mtest/source/min_element_test.cpp|+++++++++++-----------
Mtest/source/minmax_element_test.cpp|++++++++++----------

8 files changed, 80 insertions(+), 80 deletions(-)


diff --git a/test/source/count_if_test.cpp b/test/source/count_if_test.cpp

@@ -19,7 +19,7 @@ struct predicate

TEST_CASE("count_if return type", "[algorithm/count_if]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(based::SameAs<based::iter_dist_t<decltype(arr)::iterator>,
decltype(based::count_if(

@@ -34,7 +34,7 @@ TEST_CASE("count_if return type", "[algorithm/count_if]")

TEST_CASE("count_if(empty)", "[algorithm/count_if]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto count =
based::count_if(std::begin(arr), std::end(arr), predicate {0});

@@ -44,7 +44,7 @@ TEST_CASE("count_if(empty)", "[algorithm/count_if]")

TEST_CASE("count_if(homogeneous)", "[algorithm/count_if]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
const auto count0 =
based::count_if(std::begin(arr), std::end(arr), predicate {0});

@@ -57,7 +57,7 @@ TEST_CASE("count_if(homogeneous)", "[algorithm/count_if]")

TEST_CASE("count_if(non homogeneous)", "[algorithm/count_if]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
const auto count0 =
based::count_if(std::begin(arr), std::end(arr), predicate {0});

@@ -73,7 +73,7 @@ TEST_CASE("count_if(non homogeneous)", "[algorithm/count_if]")

TEST_CASE("count_if_not return type", "[algorithm/count_if_not]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(based::SameAs<based::iter_dist_t<decltype(arr)::iterator>,
decltype(based::count_if_not(

@@ -88,7 +88,7 @@ TEST_CASE("count_if_not return type", "[algorithm/count_if_not]")

TEST_CASE("count_if_not(empty)", "[algorithm/count_if_not]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto count =
based::count_if_not(std::begin(arr), std::end(arr), predicate {0});

@@ -98,7 +98,7 @@ TEST_CASE("count_if_not(empty)", "[algorithm/count_if_not]")

TEST_CASE("count_if_not(homogeneous)", "[algorithm/count_if_not]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
const auto count0 =
based::count_if_not(std::begin(arr), std::end(arr), predicate {0});

@@ -111,7 +111,7 @@ TEST_CASE("count_if_not(homogeneous)", "[algorithm/count_if_not]")

TEST_CASE("count_if_not(non homogeneous)", "[algorithm/count_if_not]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
const auto count0 =
based::count_if_not(std::begin(arr), std::end(arr), predicate {0});

diff --git a/test/source/count_test.cpp b/test/source/count_test.cpp

@@ -7,7 +7,7 @@

TEST_CASE("count return type", "[algorithm/count]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(
based::SameAs<based::iter_dist_t<decltype(arr)::iterator>,

@@ -21,7 +21,7 @@ TEST_CASE("count return type", "[algorithm/count]")

TEST_CASE("count(empty)", "[algorithm/count]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto count = based::count(std::begin(arr), std::end(arr), 0);

@@ -30,7 +30,7 @@ TEST_CASE("count(empty)", "[algorithm/count]")

TEST_CASE("count(homogeneous)", "[algorithm/count]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
const auto count0 = based::count(std::begin(arr), std::end(arr), 0);
const auto count1 = based::count(std::begin(arr), std::end(arr), 1);

@@ -41,7 +41,7 @@ TEST_CASE("count(homogeneous)", "[algorithm/count]")

TEST_CASE("count(non homogeneous)", "[algorithm/count]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
const auto count0 = based::count(std::begin(arr), std::end(arr), 0);
const auto count1 = based::count(std::begin(arr), std::end(arr), 1);

@@ -54,7 +54,7 @@ TEST_CASE("count(non homogeneous)", "[algorithm/count]")

TEST_CASE("count_not return type", "[algorithm/count_not]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(based::SameAs<based::iter_dist_t<decltype(arr)::iterator>,
decltype(based::count_not(

@@ -68,7 +68,7 @@ TEST_CASE("count_not return type", "[algorithm/count_not]")

TEST_CASE("count_not(empty)", "[algorithm/count_not]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto count_not = based::count_not(std::begin(arr), std::end(arr), 0);

@@ -77,7 +77,7 @@ TEST_CASE("count_not(empty)", "[algorithm/count_not]")

TEST_CASE("count_not(homogeneous)", "[algorithm/count_not]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
const auto count0 = based::count_not(std::begin(arr), std::end(arr), 0);
const auto count1 = based::count_not(std::begin(arr), std::end(arr), 1);

@@ -88,7 +88,7 @@ TEST_CASE("count_not(homogeneous)", "[algorithm/count_not]")

TEST_CASE("count_not(non homogeneous)", "[algorithm/count_not]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
const auto count0 = based::count_not(std::begin(arr), std::end(arr), 0);
const auto count1 = based::count_not(std::begin(arr), std::end(arr), 1);

diff --git a/test/source/find_if_test.cpp b/test/source/find_if_test.cpp

@@ -18,7 +18,7 @@ struct predicate

TEST_CASE("find_if(empty)", "[algorithm/find_if]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto* it =
based::find_if(std::begin(arr), std::end(arr), predicate {0});

@@ -27,7 +27,7 @@ TEST_CASE("find_if(empty)", "[algorithm/find_if]")

TEST_CASE("find_if(one) = found", "[algorithm/find_if]")
{
std::array arr = {0};
const std::array arr = {0};
SECTION("found")
{

@@ -48,7 +48,7 @@ TEST_CASE("find_if(one) = found", "[algorithm/find_if]")

TEST_CASE("find_if(two) = found", "[algorithm/find_if]")
{
std::array arr = {0, 1};
const std::array arr = {0, 1};
SECTION("found 1")
{

@@ -77,7 +77,7 @@ TEST_CASE("find_if(two) = found", "[algorithm/find_if]")

TEST_CASE("find_if(multiple) = found", "[algorithm/find_if]")
{
std::array arr = {0, 0, 0, 0};
const std::array arr = {0, 0, 0, 0};
SECTION("found")
{

@@ -98,7 +98,7 @@ TEST_CASE("find_if(multiple) = found", "[algorithm/find_if]")

TEST_CASE("find_if_not(empty)", "[algorithm/find_if_not]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto* it =
based::find_if_not(std::begin(arr), std::end(arr), predicate {0});

@@ -107,7 +107,7 @@ TEST_CASE("find_if_not(empty)", "[algorithm/find_if_not]")

TEST_CASE("find_if_not(one) = found", "[algorithm/find_if_not]")
{
std::array arr = {0};
const std::array arr = {0};
SECTION("found")
{

@@ -129,7 +129,7 @@ TEST_CASE("find_if_not(one) = found", "[algorithm/find_if_not]")

TEST_CASE("find_if_not(two) = found", "[algorithm/find_if_not]")
{
std::array arr = {0, 1};
const std::array arr = {0, 1};
SECTION("found 1")
{

@@ -150,7 +150,7 @@ TEST_CASE("find_if_not(two) = found", "[algorithm/find_if_not]")

TEST_CASE("find_if_not(multiple) = found", "[algorithm/find_if_not]")
{
std::array arr = {0, 0, 0, 0};
const std::array arr = {0, 0, 0, 0};
SECTION("found")
{

@@ -171,14 +171,14 @@ TEST_CASE("find_if_not(multiple) = found", "[algorithm/find_if_not]")

TEST_CASE("all(empty)", "[algorithm/all]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(based::all(std::begin(arr), std::end(arr), predicate {0}));
}
TEST_CASE("all(homogeneous)", "[algorithm/all]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
REQUIRE(based::all(std::begin(arr), std::end(arr), predicate {1}));
REQUIRE(!based::all(std::begin(arr), std::end(arr), predicate {2}));

@@ -186,7 +186,7 @@ TEST_CASE("all(homogeneous)", "[algorithm/all]")

TEST_CASE("all(non homogenous)", "[algorithm/all]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
REQUIRE(!based::all(std::begin(arr), std::end(arr), predicate {1}));
REQUIRE(!based::all(std::begin(arr), std::end(arr), predicate {2}));

@@ -194,14 +194,14 @@ TEST_CASE("all(non homogenous)", "[algorithm/all]")

TEST_CASE("none(empty)", "[algorithm/none]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(based::none(std::begin(arr), std::end(arr), predicate {0}));
}
TEST_CASE("none(homogeneous)", "[algorithm/none]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
REQUIRE(based::none(std::begin(arr), std::end(arr), predicate {2}));
REQUIRE(!based::none(std::begin(arr), std::end(arr), predicate {1}));

@@ -209,7 +209,7 @@ TEST_CASE("none(homogeneous)", "[algorithm/none]")

TEST_CASE("none(non homogeneous)", "[algorithm/none]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
REQUIRE(based::none(std::begin(arr), std::end(arr), predicate {0}));
REQUIRE(!based::none(std::begin(arr), std::end(arr), predicate {2}));

@@ -218,14 +218,14 @@ TEST_CASE("none(non homogeneous)", "[algorithm/none]")

TEST_CASE("not_all(empty)", "[algorithm/not_all]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(based::not_all(std::begin(arr), std::end(arr), predicate {0}));
}
TEST_CASE("not_all(homogeneous)", "[algorithm/not_all]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
REQUIRE(based::not_all(std::begin(arr), std::end(arr), predicate {2}));
REQUIRE(!based::not_all(std::begin(arr), std::end(arr), predicate {1}));

@@ -233,7 +233,7 @@ TEST_CASE("not_all(homogeneous)", "[algorithm/not_all]")

TEST_CASE("not_all(non homogeneous)", "[algorithm/not_all]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
REQUIRE(based::not_all(std::begin(arr), std::end(arr), predicate {0}));
REQUIRE(based::not_all(std::begin(arr), std::end(arr), predicate {1}));

@@ -242,14 +242,14 @@ TEST_CASE("not_all(non homogeneous)", "[algorithm/not_all]")

TEST_CASE("some(empty)", "[algorithm/some]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
REQUIRE(!based::some(std::begin(arr), std::end(arr), predicate {0}));
}
TEST_CASE("some(homogeneous)", "[algorithm/some]")
{
std::array arr = {1, 1, 1, 1, 1, 1};
const std::array arr = {1, 1, 1, 1, 1, 1};
REQUIRE(based::some(std::begin(arr), std::end(arr), predicate {1}));
REQUIRE(!based::some(std::begin(arr), std::end(arr), predicate {2}));

@@ -257,7 +257,7 @@ TEST_CASE("some(homogeneous)", "[algorithm/some]")

TEST_CASE("some(non homogeneous)", "[algorithm/some]")
{
std::array arr = {1, 2, 1, 1, 1, 2};
const std::array arr = {1, 2, 1, 1, 1, 2};
REQUIRE(based::some(std::begin(arr), std::end(arr), predicate {1}));
REQUIRE(based::some(std::begin(arr), std::end(arr), predicate {2}));

diff --git a/test/source/find_test.cpp b/test/source/find_test.cpp

@@ -6,7 +6,7 @@

TEST_CASE("find(empty)", "[algorithm/find]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto* it = based::find(std::begin(arr), std::end(arr), 0);
REQUIRE(it == std::end(arr));

@@ -14,7 +14,7 @@ TEST_CASE("find(empty)", "[algorithm/find]")

TEST_CASE("find(one) = found", "[algorithm/find]")
{
std::array arr = {0};
const std::array arr = {0};
SECTION("found")
{

@@ -33,7 +33,7 @@ TEST_CASE("find(one) = found", "[algorithm/find]")

TEST_CASE("find(two) = found", "[algorithm/find]")
{
std::array arr = {0, 1};
const std::array arr = {0, 1};
SECTION("found 1")
{

@@ -59,7 +59,7 @@ TEST_CASE("find(two) = found", "[algorithm/find]")

TEST_CASE("find(multiple) = found", "[algorithm/find]")
{
std::array arr = {0, 0, 0, 0};
const std::array arr = {0, 0, 0, 0};
SECTION("found")
{

@@ -78,7 +78,7 @@ TEST_CASE("find(multiple) = found", "[algorithm/find]")

TEST_CASE("find_not(empty)", "[algorithm/find_not]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto* it = based::find_not(std::begin(arr), std::end(arr), 0);
REQUIRE(it == std::end(arr));

@@ -86,7 +86,7 @@ TEST_CASE("find_not(empty)", "[algorithm/find_not]")

TEST_CASE("find_not(one) = found", "[algorithm/find_not]")
{
std::array arr = {0};
const std::array arr = {0};
SECTION("found")
{

@@ -105,7 +105,7 @@ TEST_CASE("find_not(one) = found", "[algorithm/find_not]")

TEST_CASE("find_not(two) = found", "[algorithm/find_not]")
{
std::array arr = {0, 1};
const std::array arr = {0, 1};
SECTION("found 1")
{

@@ -124,7 +124,7 @@ TEST_CASE("find_not(two) = found", "[algorithm/find_not]")

TEST_CASE("find_not(multiple) = found", "[algorithm/find_not]")
{
std::array arr = {0, 0, 0, 0};
const std::array arr = {0, 0, 0, 0};
SECTION("found")
{

diff --git a/test/source/for_each_test.cpp b/test/source/for_each_test.cpp

@@ -13,7 +13,7 @@ struct functor

TEST_CASE("for_each(empty)", "[algorithm/for_each]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto f = based::for_each(std::begin(arr), std::end(arr), functor {});
REQUIRE(f.sum == 0);

@@ -21,7 +21,7 @@ TEST_CASE("for_each(empty)", "[algorithm/for_each]")

TEST_CASE("for_each(one)", "[algorithm/for_each]")
{
std::array arr = {1};
const std::array arr = {1};
const auto f = based::for_each(std::begin(arr), std::end(arr), functor {});
REQUIRE(f.sum == 1);

@@ -29,7 +29,7 @@ TEST_CASE("for_each(one)", "[algorithm/for_each]")

TEST_CASE("for_each(two)", "[algorithm/for_each]")
{
std::array arr = {1, 2};
const std::array arr = {1, 2};
const auto f = based::for_each(std::begin(arr), std::end(arr), functor {});
REQUIRE(f.sum == 3);

@@ -37,7 +37,7 @@ TEST_CASE("for_each(two)", "[algorithm/for_each]")

TEST_CASE("for_each(three)", "[algorithm/for_each]")
{
std::array arr = {1, 2, 3};
const std::array arr = {1, 2, 3};
const auto f = based::for_each(std::begin(arr), std::end(arr), functor {});
REQUIRE(f.sum == 6);

diff --git a/test/source/max_element_test.cpp b/test/source/max_element_test.cpp

@@ -6,14 +6,14 @@

TEST_CASE("max_element(empty)", "[algorithm/max_element]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
REQUIRE(itr == std::end(arr));
}
TEST_CASE("max_element(1)", "[algorithm/max_element]")
{
std::array arr = {0};
const std::array arr = {0};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -21,7 +21,7 @@ TEST_CASE("max_element(1)", "[algorithm/max_element]")

TEST_CASE("max_element(2) = first", "[algorithm/max_element]")
{
std::array arr = {1, 0};
const std::array arr = {1, 0};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -29,7 +29,7 @@ TEST_CASE("max_element(2) = first", "[algorithm/max_element]")

TEST_CASE("max_element(2) = second", "[algorithm/max_element]")
{
std::array arr = {0, 1};
const std::array arr = {0, 1};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

@@ -37,7 +37,7 @@ TEST_CASE("max_element(2) = second", "[algorithm/max_element]")

TEST_CASE("max_element(2) = stable", "[algorithm/max_element]")
{
std::array arr = {0, 0};
const std::array arr = {0, 0};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

@@ -45,7 +45,7 @@ TEST_CASE("max_element(2) = stable", "[algorithm/max_element]")

TEST_CASE("max_element(3) = first", "[algorithm/max_element]")
{
std::array arr = {2, 1, 0};
const std::array arr = {2, 1, 0};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -53,7 +53,7 @@ TEST_CASE("max_element(3) = first", "[algorithm/max_element]")

TEST_CASE("max_element(3) = second", "[algorithm/max_element]")
{
std::array arr = {1, 2, 0};
const std::array arr = {1, 2, 0};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

@@ -61,7 +61,7 @@ TEST_CASE("max_element(3) = second", "[algorithm/max_element]")

TEST_CASE("max_element(3) = third", "[algorithm/max_element]")
{
std::array arr = {0, 1, 2};
const std::array arr = {0, 1, 2};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 2);

@@ -69,7 +69,7 @@ TEST_CASE("max_element(3) = third", "[algorithm/max_element]")

TEST_CASE("max_element(3) = stable(1, 2)", "[algorithm/max_element]")
{
std::array arr = {1, 1, 0};
const std::array arr = {1, 1, 0};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

@@ -77,7 +77,7 @@ TEST_CASE("max_element(3) = stable(1, 2)", "[algorithm/max_element]")

TEST_CASE("max_element(3) = stable(1, 3)", "[algorithm/max_element]")
{
std::array arr = {1, 0, 1};
const std::array arr = {1, 0, 1};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 2);

@@ -85,7 +85,7 @@ TEST_CASE("max_element(3) = stable(1, 3)", "[algorithm/max_element]")

TEST_CASE("max_element(3) = stable(2, 3)", "[algorithm/max_element]")
{
std::array arr = {0, 1, 1};
const std::array arr = {0, 1, 1};
const auto* itr = based::max_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 2);

diff --git a/test/source/min_element_test.cpp b/test/source/min_element_test.cpp

@@ -6,14 +6,14 @@

TEST_CASE("min_element(empty)", "[algorithm/min_element]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
REQUIRE(itr == std::end(arr));
}
TEST_CASE("min_element(1)", "[algorithm/min_element]")
{
std::array arr = {0};
const std::array arr = {0};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -21,7 +21,7 @@ TEST_CASE("min_element(1)", "[algorithm/min_element]")

TEST_CASE("min_element(2) = first", "[algorithm/min_element]")
{
std::array arr = {0, 1};
const std::array arr = {0, 1};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -29,7 +29,7 @@ TEST_CASE("min_element(2) = first", "[algorithm/min_element]")

TEST_CASE("min_element(2) = second", "[algorithm/min_element]")
{
std::array arr = {1, 0};
const std::array arr = {1, 0};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

@@ -37,7 +37,7 @@ TEST_CASE("min_element(2) = second", "[algorithm/min_element]")

TEST_CASE("min_element(2) = stable", "[algorithm/min_element]")
{
std::array arr = {0, 0};
const std::array arr = {0, 0};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -45,7 +45,7 @@ TEST_CASE("min_element(2) = stable", "[algorithm/min_element]")

TEST_CASE("min_element(3) = first", "[algorithm/min_element]")
{
std::array arr = {0, 1, 2};
const std::array arr = {0, 1, 2};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -53,7 +53,7 @@ TEST_CASE("min_element(3) = first", "[algorithm/min_element]")

TEST_CASE("min_element(3) = second", "[algorithm/min_element]")
{
std::array arr = {1, 0, 2};
const std::array arr = {1, 0, 2};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

@@ -61,7 +61,7 @@ TEST_CASE("min_element(3) = second", "[algorithm/min_element]")

TEST_CASE("min_element(3) = third", "[algorithm/min_element]")
{
std::array arr = {2, 1, 0};
const std::array arr = {2, 1, 0};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 2);

@@ -69,7 +69,7 @@ TEST_CASE("min_element(3) = third", "[algorithm/min_element]")

TEST_CASE("min_element(3) = stable(1, 2)", "[algorithm/min_element]")
{
std::array arr = {0, 0, 1};
const std::array arr = {0, 0, 1};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -77,7 +77,7 @@ TEST_CASE("min_element(3) = stable(1, 2)", "[algorithm/min_element]")

TEST_CASE("min_element(3) = stable(1, 3)", "[algorithm/min_element]")
{
std::array arr = {0, 1, 0};
const std::array arr = {0, 1, 0};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 0);

@@ -85,7 +85,7 @@ TEST_CASE("min_element(3) = stable(1, 3)", "[algorithm/min_element]")

TEST_CASE("min_element(3) = stable(2, 3)", "[algorithm/min_element]")
{
std::array arr = {1, 0, 0};
const std::array arr = {1, 0, 0};
const auto* itr = based::min_element(std::begin(arr), std::end(arr));
const auto idx = std::distance(std::cbegin(arr), itr);
REQUIRE(idx == 1);

diff --git a/test/source/minmax_element_test.cpp b/test/source/minmax_element_test.cpp

@@ -4,7 +4,7 @@

TEST_CASE("minmax_element(empty)", "[algorithm/minmax_element]")
{
std::array<int, 0> arr = {};
const std::array<int, 0> arr = {};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
REQUIRE(min == std::end(arr));
REQUIRE(max == std::end(arr));

@@ -12,7 +12,7 @@ TEST_CASE("minmax_element(empty)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(1)", "[algorithm/minmax_element]")
{
std::array arr = {0};
const std::array arr = {0};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -22,7 +22,7 @@ TEST_CASE("minmax_element(1)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(increasing even)", "[algorithm/minmax_element]")
{
std::array arr = {0, 1, 2, 3};
const std::array arr = {0, 1, 2, 3};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -32,7 +32,7 @@ TEST_CASE("minmax_element(increasing even)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(increasing odd)", "[algorithm/minmax_element]")
{
std::array arr = {0, 1, 2, 3, 4};
const std::array arr = {0, 1, 2, 3, 4};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -42,7 +42,7 @@ TEST_CASE("minmax_element(increasing odd)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(decreasing even)", "[algorithm/minmax_element]")
{
std::array arr = {3, 2, 1, 0};
const std::array arr = {3, 2, 1, 0};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -52,7 +52,7 @@ TEST_CASE("minmax_element(decreasing even)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(decreasing odd)", "[algorithm/minmax_element]")
{
std::array arr = {4, 3, 2, 1, 0};
const std::array arr = {4, 3, 2, 1, 0};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -62,7 +62,7 @@ TEST_CASE("minmax_element(decreasing odd)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(stable even)", "[algorithm/minmax_element]")
{
std::array arr = {3, 0, 0, 3};
const std::array arr = {3, 0, 0, 3};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -72,7 +72,7 @@ TEST_CASE("minmax_element(stable even)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(stable odd)", "[algorithm/minmax_element]")
{
std::array arr = {3, 0, 3, 3, 0};
const std::array arr = {3, 0, 3, 3, 0};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -82,7 +82,7 @@ TEST_CASE("minmax_element(stable odd)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(stable increasing)", "[algorithm/minmax_element]")
{
std::array arr = {0, 0, 1, 2, 3, 4, 4};
const std::array arr = {0, 0, 1, 2, 3, 4, 4};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);

@@ -92,7 +92,7 @@ TEST_CASE("minmax_element(stable increasing)", "[algorithm/minmax_element]")

TEST_CASE("minmax_element(stable decreasing)", "[algorithm/minmax_element]")
{
std::array arr = {4, 4, 3, 2, 1, 0, 0};
const std::array arr = {4, 4, 3, 2, 1, 0, 0};
const auto [min, max] = based::minmax_element(std::begin(arr), std::end(arr));
const auto mini = std::distance(std::begin(arr), min);
const auto maxi = std::distance(std::begin(arr), max);