From a00533851427a5508190f3130ff11696034a9b3f Mon Sep 17 00:00:00 2001 From: Xuan Thang Nguyen <nguyexu2@fit.cvut.cz> Date: Fri, 9 Apr 2021 16:55:22 +0200 Subject: [PATCH] refactor out permutation 8 --- tests/bitonic_tests/unitTests.cu | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/bitonic_tests/unitTests.cu b/tests/bitonic_tests/unitTests.cu index 53fe8b3..3e0ce07 100644 --- a/tests/bitonic_tests/unitTests.cu +++ b/tests/bitonic_tests/unitTests.cu @@ -12,9 +12,9 @@ //---------------------------------------------------------------------------------- -TEST(permutations, allPermutationSize_1_to_8) +TEST(permutations, allPermutationSize_2_to_7) { - for(int i = 2; i<=8; i++ ) + for(int i = 2; i<=7; i++ ) { int size = i; std::vector<int> orig(size); @@ -33,6 +33,30 @@ TEST(permutations, allPermutationSize_1_to_8) } } +TEST(permutations, allPermutationSize_8) +{ + int size = 9; + const int stride = 151; + int i = 0; + + std::vector<int> orig(size); + std::iota(orig.begin(), orig.end(), 0); + + do + { + if ((i++) % stride != 0) + continue; + + TNL::Containers::Array<int, TNL::Devices::Cuda> cudaArr(orig); + auto view = cudaArr.getView(); + + bitonicSort(view); + + ASSERT_TRUE(is_sorted(view)) << "result " << view << std::endl; + } + while (std::next_permutation(orig.begin(), orig.end())); +} + TEST(permutations, somePermutationSize9) { int size = 9; -- GitLab