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