@Test public void testQuickSelect() throws Exception { int[] sorted = Arrays.copyOf(arr, arr.length); quickSort(sorted); // Assert every value in the array for (int i = 0; i < sorted.length; i++) { int val = sorted[i]; int select = quickSelect(arr, i); assertEquals(select, val); } }
@Test public void testQuickSort() throws Exception { quickSort(arr); assertArrayEquals(arr, expected); }