mirror of
https://codeberg.org/JasterV/uni-lab.git
synced 2026-04-26 18:40:03 +00:00
39 lines
No EOL
1 KiB
Java
39 lines
No EOL
1 KiB
Java
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class SelectionSortTest {
|
|
static final int length = 50;
|
|
|
|
@Test
|
|
void array_ordenado() {
|
|
IntArraySorter sorter = new IntArraySorter(ArrayBuilder.buildArray(length));
|
|
sorter.selectionSort();
|
|
assertTrue(sorter.isSorted());
|
|
}
|
|
|
|
@Test
|
|
void array_del_reves() {
|
|
IntArraySorter sorter = new IntArraySorter(ArrayBuilder.buildReversedArray(length));
|
|
sorter.selectionSort();
|
|
assertTrue(sorter.isSorted());
|
|
}
|
|
|
|
@Test
|
|
void array_poco_desordenado() {
|
|
IntArraySorter sorter = new IntArraySorter(ArrayBuilder.buildArray(length));
|
|
sorter.fisherYatesShuffle(length/3);
|
|
sorter.selectionSort();
|
|
assertTrue(sorter.isSorted());
|
|
}
|
|
|
|
@Test
|
|
void array_muy_desordenado() {
|
|
IntArraySorter sorter = new IntArraySorter(ArrayBuilder.buildArray(length));
|
|
sorter.fisherYatesShuffle(length);
|
|
sorter.selectionSort();
|
|
assertTrue(sorter.isSorted());
|
|
}
|
|
|
|
|
|
} |