forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPigeonholeSortTest.java
More file actions
29 lines (21 loc) · 1004 Bytes
/
PigeonholeSortTest.java
File metadata and controls
29 lines (21 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.sorts;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class PigeonholeSortTest {
@Test
void testPigeonholeSort() {
PigeonholeSort pigeonholeSort = new PigeonholeSort();
// Test Case 1
Integer[] unsorted1 = new Integer[]{5, 1, 7, 2, 9, 6, 3, 4, 8};
Integer[] sorted1 = new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
Assertions.assertArrayEquals(sorted1, pigeonholeSort.sort(unsorted1));
// Test Case 2
Integer[] unsorted2 = new Integer[]{-5, 1, 7, 2, -9, 6, -3, 4, 8};
Integer[] sorted2 = new Integer[]{-9, -5, -3, 1, 2, 4, 6, 7, 8};
Assertions.assertArrayEquals(sorted2, pigeonholeSort.sort(unsorted2));
// Test Case 3
Integer[] unsorted3 = new Integer[]{-5, 1, 7, 2, -9, 6, -3, 4, 1, 8, 1, 1};
Integer[] sorted3 = new Integer[]{-9, -5, -3, 1, 1, 1, 1, 2, 4, 6, 7, 8};
Assertions.assertArrayEquals(sorted3, pigeonholeSort.sort(unsorted3));
}
}