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