commit
7d03f03ebb
|
@ -1,4 +1,4 @@
|
||||||
package algorithms.insertionsort;
|
package com.baeldung.algorithms.insertionsort;
|
||||||
|
|
||||||
import com.baeldung.algorithms.insertionsort.InsertionSort;
|
import com.baeldung.algorithms.insertionsort.InsertionSort;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -8,7 +8,7 @@ import static org.junit.Assert.assertArrayEquals;
|
||||||
public class InsertionSortUnitTest {
|
public class InsertionSortUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUnsortedArray_whenInsertionSortImperatively_thenItIsSortedInAscendingOrder() {
|
public void givenUnsortedArray_whenInsertionSortImperative_thenSortedAsc() {
|
||||||
int[] input = {6, 2, 3, 4, 5, 1};
|
int[] input = {6, 2, 3, 4, 5, 1};
|
||||||
InsertionSort.insertionSortImperative(input);
|
InsertionSort.insertionSortImperative(input);
|
||||||
int[] expected = {1, 2, 3, 4, 5, 6};
|
int[] expected = {1, 2, 3, 4, 5, 6};
|
||||||
|
@ -16,9 +16,8 @@ public class InsertionSortUnitTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUnsortedArray_whenInsertionSortRecursively_thenItIsSortedInAscendingOrder() {
|
public void givenUnsortedArray_whenInsertionSortRecursive_thenSortedAsc() {
|
||||||
// int[] input = {6, 4, 5, 2, 3, 1};
|
int[] input = {6, 4, 5, 2, 3, 1};
|
||||||
int[] input = {6, 4};
|
|
||||||
InsertionSort.insertionSortRecursive(input);
|
InsertionSort.insertionSortRecursive(input);
|
||||||
int[] expected = {1, 2, 3, 4, 5, 6};
|
int[] expected = {1, 2, 3, 4, 5, 6};
|
||||||
assertArrayEquals("the two arrays are not equal", expected, input);
|
assertArrayEquals("the two arrays are not equal", expected, input);
|
Loading…
Reference in New Issue