Commit 02470908 authored by Torstein's avatar Torstein

Fixet feil med testcaser som gjorde at quicksort fremstod som langsom.

parent 1f42cdcb
......@@ -11,7 +11,7 @@ import inf101v16f12.recursion.Sorting;
public class TestSorting {
public static final int TESTS = 5;
public static final int LISTLEN = 750*2;
public static final int LISTLEN = 10000*2;
private static final Random r = new Random();
@Test
......@@ -54,11 +54,11 @@ public class TestSorting {
int[] lst = new int[LISTLEN];
for (int j=0; j<LISTLEN; j++) {
lst[j] = r.nextInt(LISTLEN) - (LISTLEN/2);
}
Sorting.mergeSort(lst);
assertTrue(isSorted(lst));
}
}
}
@Test
public void testQuickSortBig() {
......@@ -66,11 +66,11 @@ public class TestSorting {
int[] lst = new int[LISTLEN];
for (int j=0; j<LISTLEN; j++) {
lst[j] = r.nextInt(LISTLEN) - (LISTLEN/2);
}
Sorting.quickSort(lst);
assertTrue(isSorted(lst));
}
}
}
@Test
public void testSelectionSortBig() {
......@@ -78,11 +78,11 @@ public class TestSorting {
int[] lst = new int[LISTLEN];
for (int j=0; j<LISTLEN; j++) {
lst[j] = r.nextInt(LISTLEN) - (LISTLEN/2);
}
Sorting.selectionSort(lst);
assertTrue(isSorted(lst));
}
}
}
private static boolean isSorted(int[] lst) {
......
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