forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeadSortTest.java
More file actions
42 lines (35 loc) · 1.35 KB
/
BeadSortTest.java
File metadata and controls
42 lines (35 loc) · 1.35 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.thealgorithms.sorts;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import org.junit.jupiter.api.Test;
public class BeadSortTest {
// BeadSort can't sort negative number, Character, String. It can sort positive number only
private BeadSort beadSort = new BeadSort();
@Test
public void beadSortEmptyArray() {
int[] inputArray = {};
int[] outputArray = beadSort.sort(inputArray);
int[] expectedOutput = {};
assertArrayEquals(outputArray, expectedOutput);
}
@Test
public void beadSortSingleIntegerArray() {
int[] inputArray = {4};
int[] outputArray = beadSort.sort(inputArray);
int[] expectedOutput = {4};
assertArrayEquals(outputArray, expectedOutput);
}
@Test
public void bogoSortNonDuplicateIntegerArray() {
int[] inputArray = {6, 1, 99, 27, 15, 23, 36};
int[] outputArray = beadSort.sort(inputArray);
int[] expectedOutput = {1, 6, 15, 23, 27, 36, 99};
assertArrayEquals(outputArray, expectedOutput);
}
@Test
public void bogoSortDuplicateIntegerArray() {
int[] inputArray = {6, 1, 27, 15, 23, 27, 36, 23};
int[] outputArray = beadSort.sort(inputArray);
int[] expectedOutput = {1, 6, 15, 23, 23, 27, 27, 36};
assertArrayEquals(outputArray, expectedOutput);
}
}