|
| 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