forked from examplehub/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMergeSortTest.java
More file actions
33 lines (27 loc) · 757 Bytes
/
MergeSortTest.java
File metadata and controls
33 lines (27 loc) · 757 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
30
31
32
33
package com.examplehub.sorts;
import static org.junit.jupiter.api.Assertions.*;
import com.examplehub.utils.RandomUtils;
import com.examplehub.utils.SortUtils;
import java.util.Arrays;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class MergeSortTest {
private Sort sort;
@BeforeEach
public void before() {
sort = new MergeSort();
}
@Test
void testSort() {
int[] ints = RandomUtils.randomInts(-50, 50, 100);
sort.sort(ints);
assertTrue(SortUtils.isSorted(ints));
}
@Test
void sortInteger() {
Integer[] integers =
Arrays.stream(RandomUtils.randomInts(-50, 50, 100)).boxed().toArray(Integer[]::new);
sort.sort(integers);
assertTrue(SortUtils.isSorted(integers));
}
}