Skip to content

Commit cf7a241

Browse files
committed
New distributions test: descending_plateau
1 parent e6dbf71 commit cf7a241

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ add_executable(main-tests
208208
distributions/ascending.cpp
209209
distributions/ascending_sawtooth.cpp
210210
distributions/descending.cpp
211+
distributions/descending_plateau.cpp
211212
distributions/descending_sawtooth.cpp
212213
distributions/median_of_3_killer.cpp
213214
distributions/pipe_organ.cpp
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2025 Morwenn
3+
* SPDX-License-Identifier: MIT
4+
*/
5+
#include <list>
6+
#include <vector>
7+
#include <catch2/catch_template_test_macros.hpp>
8+
#include <cpp-sort/sorters.h>
9+
#include <cpp-sort/utility/buffer.h>
10+
#include <cpp-sort/utility/functional.h>
11+
#include <testing-tools/distributions.h>
12+
#include "test_distribution.h"
13+
14+
TEMPLATE_TEST_CASE( "test random-access sorters with descending_plateau distribution", "[distributions]",
15+
cppsort::adaptive_shivers_sorter,
16+
cppsort::cartesian_tree_sorter,
17+
cppsort::d_ary_heap_sorter<6>,
18+
cppsort::drop_merge_sorter,
19+
cppsort::grail_sorter<>,
20+
cppsort::grail_sorter<
21+
cppsort::utility::dynamic_buffer<cppsort::utility::sqrt>
22+
>,
23+
cppsort::heap_sorter,
24+
cppsort::mel_sorter,
25+
cppsort::merge_sorter,
26+
cppsort::pdq_sorter,
27+
cppsort::poplar_sorter,
28+
cppsort::quick_merge_sorter,
29+
cppsort::quick_sorter,
30+
cppsort::ska_sorter,
31+
cppsort::slab_sorter,
32+
cppsort::smooth_sorter,
33+
cppsort::spin_sorter,
34+
cppsort::splay_sorter,
35+
cppsort::split_sorter,
36+
cppsort::spread_sorter,
37+
cppsort::std_sorter,
38+
cppsort::tim_sorter,
39+
cppsort::verge_sorter,
40+
cppsort::wiki_sorter<>,
41+
cppsort::wiki_sorter<
42+
cppsort::utility::dynamic_buffer<cppsort::utility::half>
43+
> )
44+
{
45+
std::vector<int> collection;
46+
helpers::test_distribution<TestType>(collection, 10'000, dist::descending_plateau{});
47+
}
48+
49+
TEMPLATE_TEST_CASE( "test bidirectional sorters with descending_plateau distribution", "[distributions]",
50+
cppsort::cartesian_tree_sorter,
51+
cppsort::drop_merge_sorter,
52+
cppsort::merge_sorter,
53+
cppsort::quick_merge_sorter,
54+
cppsort::quick_sorter,
55+
cppsort::slab_sorter,
56+
cppsort::splay_sorter,
57+
cppsort::verge_sorter )
58+
{
59+
std::list<int> collection;
60+
helpers::test_distribution<TestType>(collection, 1000, dist::descending_plateau{});
61+
}

0 commit comments

Comments
 (0)