mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-21 19:50:35 +01:00
add sort test
This commit is contained in:
parent
e182ecc756
commit
a782d8c1fa
@ -2,6 +2,7 @@ package de.uni_marburg.powersort.sort;
|
|||||||
|
|
||||||
import de.uni_marburg.powersort.JUnitUtil;
|
import de.uni_marburg.powersort.JUnitUtil;
|
||||||
import de.uni_marburg.powersort.data.AscendingRuns;
|
import de.uni_marburg.powersort.data.AscendingRuns;
|
||||||
|
import de.uni_marburg.powersort.data.DescendingIntegers;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.converter.ConvertWith;
|
import org.junit.jupiter.params.converter.ConvertWith;
|
||||||
import org.junit.jupiter.params.provider.CsvSource;
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
@ -17,9 +18,8 @@ public abstract class AbstractSortTest {
|
|||||||
@CsvSource({
|
@CsvSource({
|
||||||
"''",
|
"''",
|
||||||
"1337",
|
"1337",
|
||||||
"3|2|1",
|
"|2|3|1",
|
||||||
"1|1",
|
"1|1",
|
||||||
"2|1",
|
|
||||||
"2|1|2",
|
"2|1|2",
|
||||||
})
|
})
|
||||||
void test1(@ConvertWith(JUnitUtil.IntegerArrayConverter.class) Integer[] array) {
|
void test1(@ConvertWith(JUnitUtil.IntegerArrayConverter.class) Integer[] array) {
|
||||||
@ -35,6 +35,17 @@ public abstract class AbstractSortTest {
|
|||||||
Integer[] array = AscendingRuns.newAscendingRuns(numOfRuns, runLength, decreaseBetweenRuns).getCopy();
|
Integer[] array = AscendingRuns.newAscendingRuns(numOfRuns, runLength, decreaseBetweenRuns).getCopy();
|
||||||
sortAndCheckResult(array);
|
sortAndCheckResult(array);
|
||||||
}
|
}
|
||||||
|
@ParameterizedTest
|
||||||
|
@CsvSource({
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"13",
|
||||||
|
"1337",
|
||||||
|
})
|
||||||
|
void test2(int size) {
|
||||||
|
Integer[] array = new DescendingIntegers(size).getCopy();
|
||||||
|
sortAndCheckResult(array);
|
||||||
|
}
|
||||||
|
|
||||||
void sortAndCheckResult(Integer[] array){
|
void sortAndCheckResult(Integer[] array){
|
||||||
Integer[] expected = Arrays.copyOf(array, array.length);
|
Integer[] expected = Arrays.copyOf(array, array.length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user