diff --git a/PR2pvl/src/Bubblesort.java b/PR2pvl/src/Bubblesort.java index c81ffa5..9b14103 100644 --- a/PR2pvl/src/Bubblesort.java +++ b/PR2pvl/src/Bubblesort.java @@ -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; } diff --git a/PR2pvl/src/InsertionSortTest.java b/PR2pvl/src/InsertionSortTest.java new file mode 100644 index 0000000..6b89a22 --- /dev/null +++ b/PR2pvl/src/InsertionSortTest.java @@ -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); + } + +} diff --git a/PR2pvl/src/bubbletest.java b/PR2pvl/src/bubbletest.java index 85002c5..967cfea 100644 --- a/PR2pvl/src/bubbletest.java +++ b/PR2pvl/src/bubbletest.java @@ -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); } }