Corrected the InsertionSort test

This commit is contained in:
varunu28 2018-09-08 08:21:27 -07:00
parent c4a13fc64c
commit 4e7843b801
2 changed files with 7 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
Java.iml Java.iml
.idea/* .idea/*
out/ out/
Downloads.iml *.iml

View File

@ -15,16 +15,16 @@ public class InsertionSortTest {
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt)); Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt));
Integer[] unsortedInt = new Integer[]{5,4,3,2,1,0}; unsortedInt = new Integer[]{5,4,3,2,1,0};
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5}; sortedInt = new Integer[]{0, 1, 2, 3, 4, 5};
Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt)); Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt));
Integer[] unsortedInt = new Integer[]{-1,-2,-3,-4,-5}; unsortedInt = new Integer[]{-1,-2,-3,-4,-5};
Integer[] sortedInt = new Integer[]{-5,-4,-3,-2,-1}; sortedInt = new Integer[]{-5,-4,-3,-2,-1};
Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt)); Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt));
Integer[] unsortedInt = new Integer[]{-1,-5,-10,-990,990,1010}; unsortedInt = new Integer[]{-1,-5,-10,-990,990,1010};
Integer[] sortedInt = new Integer[]{-990,-10,-5,-1,990,1010}; sortedInt = new Integer[]{-990,-10,-5,-1,990,1010};
Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt)); Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt));
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'}; Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};