MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testSortD

Method testSortD

JSAT/test/jsat/utils/QuickSortTest.java:50–68  ·  view source on GitHub ↗

Test of sort method, of class QuickSort.

()

Source from the content-addressed store, hash-verified

48 * Test of sort method, of class QuickSort.
49 */
50 @Test
51 public void testSortD()
52 {
53 System.out.println("sort");
54 Random rand = RandomUtil.getRandom();
55 for(int size = 2; size < 10000; size*=2)
56 {
57 double[] x = new double[size];
58 for(int i = 0; i < x.length; i++)
59 if(rand.nextInt(10) == 0)//force behavrio of multiple pivots with exact same value
60 x[i] = rand.nextInt(10);
61 else
62 x[i] = rand.nextDouble();
63 QuickSort.sort(x, 0, size);
64
65 for(int i = 0; i < x.length-1; i++)
66 assertTrue(x[i] <= x[i+1]);
67 }
68 }
69
70 @Test
71 public void testSortDP()

Callers

nothing calls this directly

Calls 3

getRandomMethod · 0.95
sortMethod · 0.95
nextDoubleMethod · 0.45

Tested by

no test coverage detected