- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathQuickSortTest.java
More file actions
Latest commit
28 lines (18 loc) · 666 Bytes
/
Copy pathQuickSortTest.java
File metadata and controls
28 lines (18 loc) · 666 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
packagesorting;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importorg.junit.jupiter.api.DisplayName;
importorg.junit.jupiter.api.Test;
publicclassQuickSortTest {
@Test
@DisplayName("quick sort")
voidtestSort() {
int[] actual = newint[] { 6, 7, 3, 8, 2, 9, 10, 4, 5 };
QuickSortqs = newQuickSort();
qs.sort(actual, 0, actual.length - 1);
int[] expected = newint[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
StringactualOut = qs.display(actual);
StringexpectedOut = qs.display(expected);
assertEquals(expectedOut, actualOut, "quick sorting should work");
System.out.println("Test - Quick Sort: sort() - passed ok");
}
}