Skip to content

Commit 905c19a

Browse files
committed
test: add standalone radix sort test file
1 parent 2e2f2a6 commit 905c19a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// competitive-verifier: STANDALONE
2+
3+
#include "../../src/alfred/algorithm/radix-sort.hpp"
4+
#include <cassert>
5+
#include <random>
6+
7+
const int N = 100000000;
8+
9+
uint32_t a[N];
10+
std::mt19937 rng(std::random_device{}());
11+
12+
int main(int argc, char const *argv[]) {
13+
for (int i = 0; i < N; i++) {
14+
a[i] = rng();
15+
}
16+
radix_sort(a, N);
17+
for (int i = 1; i < N; i++) {
18+
assert(a[i - 1] <= a[i]);
19+
}
20+
return 0;
21+
}

0 commit comments

Comments
 (0)