fix: add test

This commit is contained in:
Jungwoo
2024-04-05 17:03:25 +09:00
committed by Philip K.F. Hölzenspies
parent 35490dc559
commit 0f9ef53126
3 changed files with 4 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ final class MergeSort {
SortComparatorNode comparator,
@Nullable VmFunction function) {
if (comparator.executeWith(array[mid-1], array[mid], function)) {
if (comparator.executeWith(array[mid - 1], array[mid], function)) {
return; // already sorted
}

View File

@@ -4,6 +4,7 @@ local list1 = List(1, 2, 3)
local list2 = List(1, 2, 3, 4, 5)
local list3 = List(1, 2, 3, 2, 1)
local comparator = (x, y) -> x < y
local comparator1 = (x, y) -> x <= y
facts {
["isEmpty"] {
@@ -243,6 +244,7 @@ examples {
List().sortWith(comparator)
List(3, 1, 1, 2, 1).sortWith(comparator)
List(3, 1, 2, 5, 4).sortWith(comparator)
List(0, 0, 1, 2, 3, 3, 4, 5, 4, 1).sortWith(comparator1)
}
["replaceRange()"] {

View File

@@ -197,6 +197,7 @@ examples {
List()
List(1, 1, 1, 2, 3)
List(1, 2, 3, 4, 5)
List(0, 0, 1, 1, 2, 3, 3, 4, 4, 5)
}
["replaceRange()"] {
List(1, 9, 8, 5)