Unit test for MergeSort
This commit is contained in:
parent
a4521a9b04
commit
6a3eec15e5
|
@ -0,0 +1,25 @@
|
|||
package com.baeldung.algorithms.mergesort;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class MergeSortTest {
|
||||
|
||||
@Test
|
||||
void positiveTest() {
|
||||
int[] input = { 5, 1, 6, 2, 3, 4 };
|
||||
int[] expected = { 1, 2, 3, 4, 5, 6 };
|
||||
MergeSort.mergeSort(input, input.length);
|
||||
assertArrayEquals(expected, input);
|
||||
}
|
||||
|
||||
@Test
|
||||
void negativeTest() {
|
||||
int[] input = { 5, 1, 6, 2, 3, 4 };
|
||||
int[] expected = { 1, 2, 3, 4, 6, 5 };
|
||||
MergeSort.mergeSort(input, input.length);
|
||||
assertArrayEquals(expected, input);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue