Commit fefc815d authored by BRAMAS Berenger's avatar BRAMAS Berenger

add utest quicksort

parent e98870ea
...@@ -98,12 +98,34 @@ class TestQuickSort : public FUTester<TestQuickSort> { ...@@ -98,12 +98,34 @@ class TestQuickSort : public FUTester<TestQuickSort> {
delete [] array; delete [] array;
} }
void verySmallParts(){
{
long long values[2] = {0, 1};
FQuickSort<long long, long>::QsSequential(values, 2);
uassert(values[0] == 0);
uassert(values[1] == 1);
}
{
long long values[2] = {1, 0};
FQuickSort<long long, long>::QsSequential(values, 2);
uassert(values[0] == 0);
uassert(values[1] == 1);
}
{
long long values[2] = {0, 0};
FQuickSort<long long, long>::QsSequential(values, 2);
uassert(values[0] == 0);
uassert(values[1] == 0);
}
}
// set test // set test
void SetTests(){ void SetTests(){
AddTest(&TestQuickSort::manyThreads,"Many threads"); AddTest(&TestQuickSort::manyThreads,"Many threads");
AddTest(&TestQuickSort::bigSize,"Big sort"); AddTest(&TestQuickSort::bigSize,"Big sort");
AddTest(&TestQuickSort::reversed,"Reversed"); AddTest(&TestQuickSort::reversed,"Reversed");
AddTest(&TestQuickSort::alreadySorted,"Already Sorted"); AddTest(&TestQuickSort::alreadySorted,"Already Sorted");
AddTest(&TestQuickSort::verySmallParts,"Small Parts");
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment