11/*
2- * Copyright (c) 2017-2022 Morwenn
2+ * Copyright (c) 2017-2024 Morwenn
33 * SPDX-License-Identifier: MIT
44 */
5- #include < algorithm>
6- #include < iterator>
75#include < list>
86#include < vector>
97#include < catch2/catch_template_test_macros.hpp>
108#include < cpp-sort/sorters.h>
119#include < cpp-sort/utility/buffer.h>
1210#include < cpp-sort/utility/functional.h>
1311#include < testing-tools/distributions.h>
12+ #include " test_distribution.h"
1413
1514TEMPLATE_TEST_CASE ( " test random-access sorters with descending_sawtooth distribution" , " [distributions]" ,
1615 cppsort::adaptive_shivers_sorter,
@@ -44,13 +43,7 @@ TEMPLATE_TEST_CASE( "test random-access sorters with descending_sawtooth distrib
4443 > )
4544{
4645 std::vector<int > collection;
47- collection.reserve (10'000 );
48- auto distribution = dist::descending_sawtooth{};
49- distribution (std::back_inserter (collection), 10'000 );
50-
51- TestType sorter;
52- sorter (collection);
53- CHECK ( std::is_sorted (collection.begin (), collection.end ()) );
46+ helpers::test_distribution<TestType>(collection, 10'000 , dist::descending_sawtooth{});
5447}
5548
5649TEMPLATE_TEST_CASE ( " test bidirectional sorters with descending_sawtooth distribution" , " [distributions]" ,
@@ -64,10 +57,5 @@ TEMPLATE_TEST_CASE( "test bidirectional sorters with descending_sawtooth distrib
6457 cppsort::verge_sorter )
6558{
6659 std::list<int > collection;
67- auto distribution = dist::descending_sawtooth{};
68- distribution (std::back_inserter (collection), 1000 );
69-
70- TestType sorter;
71- sorter (collection);
72- CHECK ( std::is_sorted (collection.begin (), collection.end ()) );
60+ helpers::test_distribution<TestType>(collection, 1000 , dist::descending_sawtooth{});
7361}
0 commit comments