Skip to content

Commit 9f78d1f

Browse files
authored
Added test cases to OddEvenSort. (TheAlgorithms#3768)
* Add testcase to CocktailShakerSort Algorithm * fixed method name to lowerCamelCase * Added test cases to OddEvenSortTest
1 parent ac71f6e commit 9f78d1f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.thealgorithms.sorts;
2+
3+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
/**
8+
* @author Tabbygray (https://github.com/Tabbygray)
9+
* @see OddEvenSort
10+
*/
11+
12+
public class OddEvenSortTest {
13+
private OddEvenSort oddEvenSort = new OddEvenSort();
14+
15+
@Test
16+
public void oddEvenSortEmptyArray(){
17+
int[] inputArray = {};
18+
oddEvenSort.oddEvenSort(inputArray);
19+
int[] expectedOutput = {};
20+
assertArrayEquals(inputArray, expectedOutput);
21+
}
22+
23+
@Test
24+
public void oddEvenSortNaturalNumberArray(){
25+
int[] inputArray = {18, 91, 86, 60, 21, 44, 37, 78, 98, 67};
26+
oddEvenSort.oddEvenSort(inputArray);
27+
int[] expectedOutput = {18, 21, 37, 44, 60, 67, 78, 86, 91, 98};
28+
assertArrayEquals(inputArray, expectedOutput);
29+
}
30+
31+
@Test
32+
public void oddEvenSortIntegerArray(){
33+
int[] inputArray = {57, 69, -45, 12, -85, 3, -76, 36, 67, -14};
34+
oddEvenSort.oddEvenSort(inputArray);
35+
int[] expectedOutput = {-85, -76, -45, -14, 3, 12, 36, 57, 67, 69};
36+
assertArrayEquals(inputArray, expectedOutput);
37+
}
38+
39+
}

0 commit comments

Comments
 (0)