Skip to content

Commit 6de8705

Browse files
committed
add Test for InsertionSort;
delete print statements from Test files.
1 parent 4709345 commit 6de8705

File tree

6 files changed

+6
-36
lines changed

6 files changed

+6
-36
lines changed

src/test/java/com/sorts/BubbleSortTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@
55
import org.junit.Test;
66
import src.main.java.com.sorts.BubbleSort;
77

8-
import java.util.Arrays;
9-
108
public class BubbleSortTest {
119

1210
@Test
1311
public void bubbleSortTest() {
1412
BubbleSort bubbleSort = new BubbleSort();
13+
1514
Integer[] unsortedInt = new Integer[]{0, 5, 9, 2, 1, 3, 4, 8, 6, 7};
1615
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
17-
System.out.println(Arrays.toString(bubbleSort.sort(unsortedInt)));
18-
1916
Assert.assertArrayEquals(sortedInt, bubbleSort.sort(unsortedInt));
2017

2118
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};
2219
Character[] sortedChar = new Character[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
23-
System.out.println(Arrays.toString(bubbleSort.sort(unsortedChar)));
24-
2520
Assert.assertArrayEquals(sortedChar, bubbleSort.sort(unsortedChar));
2621

2722
}

src/test/java/com/sorts/HeapSortTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@
55
import org.junit.Test;
66
import src.main.java.com.sorts.HeapSort;
77

8-
import java.util.Arrays;
9-
108
public class HeapSortTest {
119

1210
@Test
1311
public void heapSortTest() {
1412
HeapSort heapSort = new HeapSort();
13+
1514
Integer[] unsortedInt = new Integer[]{0, 5, 9, 2, 1, 3, 4, 8, 6, 7};
1615
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
17-
System.out.println(Arrays.toString(heapSort.sort(unsortedInt)));
18-
1916
Assert.assertArrayEquals(sortedInt, heapSort.sort(unsortedInt));
2017

2118
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};
2219
Character[] sortedChar = new Character[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
23-
System.out.println(Arrays.toString(heapSort.sort(unsortedChar)));
24-
2520
Assert.assertArrayEquals(sortedChar, heapSort.sort(unsortedChar));
2621
}
2722
}

src/test/java/com/sorts/InsertionSortTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@
55
import org.junit.Test;
66
import src.main.java.com.sorts.InsertionSort;
77

8-
import java.util.Arrays;
9-
108
public class InsertionSortTest {
119

1210
@Test
1311
public void insertionSortTest() {
1412
InsertionSort insertionSort = new InsertionSort();
13+
1514
Integer[] unsortedInt = new Integer[]{0, 5, 9, 2, 1, 3, 4, 8, 6, 7};
1615
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
17-
System.out.println(Arrays.toString(insertionSort.sort(unsortedInt)));
18-
1916
Assert.assertArrayEquals(sortedInt, insertionSort.sort(unsortedInt));
2017

2118
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};
2219
Character[] sortedChar = new Character[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
23-
System.out.println(Arrays.toString(insertionSort.sort(unsortedChar)));
24-
2520
Assert.assertArrayEquals(sortedChar, insertionSort.sort(unsortedChar));
2621
}
2722
}

src/test/java/com/sorts/QuickSortTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@
55
import org.junit.Test;
66
import src.main.java.com.sorts.QuickSort;
77

8-
import java.util.Arrays;
9-
108
public class QuickSortTest {
119

1210
@Test
1311
public void quickSortTest() {
1412
QuickSort quickSort = new QuickSort();
13+
1514
Integer[] unsortedInt = new Integer[]{0, 5, 9, 2, 1, 3, 4, 8, 6, 7};
1615
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
17-
System.out.println(Arrays.toString(quickSort.sort(unsortedInt)));
18-
1916
Assert.assertArrayEquals(sortedInt, quickSort.sort(unsortedInt));
2017

2118
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};
2219
Character[] sortedChar = new Character[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
23-
System.out.println(Arrays.toString(quickSort.sort(unsortedChar)));
24-
2520
Assert.assertArrayEquals(sortedChar, quickSort.sort(unsortedChar));
2621
}
2722
}

src/test/java/com/sorts/SelectionSortTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@
44
import org.junit.Test;
55
import src.main.java.com.sorts.SelectionSort;
66

7-
import java.util.Arrays;
8-
97
public class SelectionSortTest {
108

119
@Test
1210
public void selectionSortTest() {
1311
SelectionSort selectionSort = new SelectionSort();
12+
1413
Integer[] unsortedInt = new Integer[]{0, 5, 9, 2, 1, 3, 4, 8, 6, 7};
1514
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
16-
System.out.println(Arrays.toString(selectionSort.sort(unsortedInt)));
17-
1815
Assert.assertArrayEquals(sortedInt, selectionSort.sort(unsortedInt));
1916

2017
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};
2118
Character[] sortedChar = new Character[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
22-
System.out.println(Arrays.toString(selectionSort.sort(unsortedChar)));
23-
2419
Assert.assertArrayEquals(sortedChar, selectionSort.sort(unsortedChar));
2520
}
2621
}

src/test/java/com/sorts/ShellSortTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@
44
import org.junit.Test;
55
import src.main.java.com.sorts.ShellSort;
66

7-
import java.util.Arrays;
8-
97
public class ShellSortTest {
108

119
@Test
1210
public void shellSortTest() {
1311
ShellSort shellSort = new ShellSort();
12+
1413
Integer[] unsortedInt = new Integer[]{0, 5, 9, 2, 1, 3, 4, 8, 6, 7};
1514
Integer[] sortedInt = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
16-
System.out.println(Arrays.toString(shellSort.sort(unsortedInt)));
17-
1815
Assert.assertArrayEquals(sortedInt, shellSort.sort(unsortedInt));
1916

2017
Character[] unsortedChar = new Character[]{'f', 'h', 'c', 'a', 'b', 'd', 'g', 'e'};
2118
Character[] sortedChar = new Character[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
22-
System.out.println(Arrays.toString(shellSort.sort(unsortedChar)));
23-
2419
Assert.assertArrayEquals(sortedChar, shellSort.sort(unsortedChar));
2520
}
2621
}

0 commit comments

Comments
 (0)