-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMergeSortTest.java
More file actions
34 lines (28 loc) · 936 Bytes
/
MergeSortTest.java
File metadata and controls
34 lines (28 loc) · 936 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
34
package sort;
import org.junit.Assert;
import org.junit.Test;
import sort.InsertionSort;
import sort.MergeSort;
import util.TestAssetEngine;
import java.util.Arrays;
/**
* Contains unit tests for methods contained within the MergeSort class.
*/
public class MergeSortTest {
private MergeSort sort;
private TestAssetEngine engine;
public MergeSortTest() {
this.sort = new MergeSort();
this.engine = new TestAssetEngine(new TestAssetEngine.TestAssetEngineBuilder().upperBoundSize(1500));
}
@Test
public void mergeSortRecursiveFullTest() {
int[] arr = this.engine.generateUnorderedIntegerArray();
int[] expected = new int[arr.length];
System.arraycopy(arr, 0, expected, 0, arr.length);
Arrays.sort(expected);
this.sort.mergeSortRecursive(arr, 0, arr.length - 1);
int[] actual = arr;
Assert.assertArrayEquals(expected, actual);
}
}