12template<
size_t N,
class T =
int>
void
16 for (
size_t i = 0; i < N; i++)
22 for (
size_t i = 1; i < N; i++)
28static uint64_t romu_state64a = 1, romu_state64b = 0xda942042e4dd58b5ULL;
32 const uint64_t result1 = romu_state64a, result2 = romu_state64b;
33 romu_state64a =
rotl (romu_state64a, 32) * 15241094284759029579u;
34 romu_state64b =
rotl (romu_state64b, 32) * 0x5851f42d4c957f2dUL;
35 return result1 | (
uint64_t (result2) << 32);
38template<
size_t N,
class T =
int>
void
39check_randomized (
size_t runs)
42 for (
size_t j = 0; j < runs; j++)
44 for (
size_t i = 0; i < N; i++)
45 array[i] = romumono2();
47 for (
size_t i = 1; i < N; i++)
60 romumono2(); romumono2(); romumono2(); romumono2(); romumono2();
62 constexpr const size_t RUNS = 9999;
63 check_permutations<1,int>();
64 check_permutations<2,int>();
65 check_permutations<3,int>();
66 check_permutations<4,int>();
67 check_permutations<5,int>();
68 check_permutations<6,int>();
69 check_permutations<7,int>();
70 check_permutations<8,int>();
71 check_permutations<9,int>();
72 check_randomized<10,int> (RUNS);
73 check_randomized<11,int> (RUNS);
74 check_randomized<12,int> (RUNS);
75 check_randomized<13,int> (RUNS);
76 check_randomized<14,int> (RUNS);
77 check_randomized<15,int> (RUNS);
78 check_randomized<16,int> (RUNS);
84 TASSERT (s1.end() == s1.find (5));
86 TASSERT (
false == s1.contains (5));
89 TASSERT (
true == s1.contains (5));
91 TASSERT (s1.sorted () ==
false && s1.sorted (
true) ==
true);
93 const size_t col = s1.collapse();
94 TASSERT (col == 1 && s1[0] != s1[1]);
96 erase_if (s1, [] (
auto v) {
return v & 1; });
97 TASSERT (s1.size() == 3 && s1[0] == 4 && s1[1] == 6 && s1[2] == 8);
99 TASSERT (s1.size() == 0 && s1.sorted());
Vector that keeps its elements sorted.
#define assert_return(expr,...)
Return from the current function if expr is unmet and issue an assertion warning.
#define TEST_INTEGRITY(FUNC)
Register func as an integrity test.
uint64_t random_int64()
Return random int for reproduceble tests.
The Anklang C++ API namespace.
void fixed_sort(RandomIt first, RandomIt last, Compare comp=std::less< typename std::iterator_traits< RandomIt >::value_type >())
Use sorting networks to sort containers <= 16 elements without allocations.
T next_permutation(T... args)
#define TASSERT(cond)
Unconditional test assertion, enters breakpoint if not fullfilled.