JUnit Tesst für InsertionSort wurde geschrieben
parent
0a74c20f07
commit
44d1dd85c2
|
|
@ -8,7 +8,7 @@ public class Bubblesort {
|
|||
|
||||
|
||||
}
|
||||
public static void bubblesort(int[] arr) {
|
||||
public static int[] bubblesort(int[] arr) {
|
||||
|
||||
boolean ready = false;
|
||||
|
||||
|
|
@ -29,6 +29,7 @@ public class Bubblesort {
|
|||
|
||||
System.out.println(Arrays.toString(arr));
|
||||
} // while
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class InsertionSortTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
|
||||
int[] arr = {9, 7, 6, 5, 4, 2, 1, 0};
|
||||
int[] fin = {0, 1, 2, 4, 5, 6, 7, 9};
|
||||
|
||||
Assert.assertArrayEquals(InsertionSort.insertionSort(arr), fin);
|
||||
Assert.assertArrayEquals(InsertionSort.insertionSortLSG(arr), fin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
class bubbletest {
|
||||
public class bubbletest {
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
public void test() {
|
||||
|
||||
int arr[] = {3,2,5};
|
||||
int fin[]= {2,3,5};
|
||||
|
||||
|
||||
|
||||
Assert.assertArrayEquals(Bubblesort.bubblesort(arr), fin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue