File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/test/java/com/github/coderodde/util Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,32 @@ public void testSerialRadixSort() {
7878 assertTrue (Arrays .equals (array1 , array2 ));
7979 }
8080
81+
82+ @ Test
83+ public void testParallelRadixSort () {
84+ Random random = new Random (29 );
85+
86+ final int SIZE = 5_000_000 ;
87+
88+ int [] array1 = Utils .createRandomIntArray (
89+ SIZE ,
90+ Integer .MAX_VALUE - 1 ,
91+ random );
92+
93+ int [] array2 = array1 .clone ();
94+
95+ final int FROM_INDEX = 13 ;
96+ final int TO_INDEX = SIZE - 15 ;
97+
98+ Arrays .sort (array1 , FROM_INDEX , TO_INDEX );
99+ ParallelRadixSort .parallelSort (
100+ array2 ,
101+ FROM_INDEX ,
102+ TO_INDEX );
103+
104+ assertTrue (Arrays .equals (array1 , array2 ));
105+ }
106+
81107 @ Test
82108 public void bruteForceTestInsertionsort () {
83109 final int ITERATIONS = 200 ;
You can’t perform that action at this time.
0 commit comments