-
-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathQuickSortTest.java
More file actions
30 lines (22 loc) · 754 Bytes
/
Copy pathQuickSortTest.java
File metadata and controls
30 lines (22 loc) · 754 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
package util;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* Created by nikoo28 on 10/11/20 5:02 PM
*/
class QuickSortTest {
@Test
void testQuickSort1() {
int[] arr = {7, 3, 9, 5, 4, 8, 0, 1};
int[] sortedArray = {0, 1, 3, 4, 5, 7, 8, 9};
QuickSort.quickSort(arr, 0, arr.length - 1);
assertArrayEquals(sortedArray, arr);
}
@Test
void testQuickSort2() {
int[] arr = {7, 3, 9, 5, 4, 8, 0, 1, -1, -2, -6, -7, -3, -5, -99, -100, 9999, 34, 12, 5653, 1213, 6563};
int[] sortedArray = {-100, -99, -7, -6, -5, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 12, 34, 1213, 5653, 6563, 9999};
QuickSort.quickSort(arr, 0, arr.length - 1);
assertArrayEquals(sortedArray, arr);
}
}