mirror of
https://github.com/apple/pkl.git
synced 2026-04-25 01:38:34 +02:00
fix: add test
This commit is contained in:
committed by
Philip K.F. Hölzenspies
parent
35490dc559
commit
0f9ef53126
@@ -58,7 +58,7 @@ final class MergeSort {
|
|||||||
SortComparatorNode comparator,
|
SortComparatorNode comparator,
|
||||||
@Nullable VmFunction function) {
|
@Nullable VmFunction function) {
|
||||||
|
|
||||||
if (comparator.executeWith(array[mid-1], array[mid], function)) {
|
if (comparator.executeWith(array[mid - 1], array[mid], function)) {
|
||||||
return; // already sorted
|
return; // already sorted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ local list1 = List(1, 2, 3)
|
|||||||
local list2 = List(1, 2, 3, 4, 5)
|
local list2 = List(1, 2, 3, 4, 5)
|
||||||
local list3 = List(1, 2, 3, 2, 1)
|
local list3 = List(1, 2, 3, 2, 1)
|
||||||
local comparator = (x, y) -> x < y
|
local comparator = (x, y) -> x < y
|
||||||
|
local comparator1 = (x, y) -> x <= y
|
||||||
|
|
||||||
facts {
|
facts {
|
||||||
["isEmpty"] {
|
["isEmpty"] {
|
||||||
@@ -243,6 +244,7 @@ examples {
|
|||||||
List().sortWith(comparator)
|
List().sortWith(comparator)
|
||||||
List(3, 1, 1, 2, 1).sortWith(comparator)
|
List(3, 1, 1, 2, 1).sortWith(comparator)
|
||||||
List(3, 1, 2, 5, 4).sortWith(comparator)
|
List(3, 1, 2, 5, 4).sortWith(comparator)
|
||||||
|
List(0, 0, 1, 2, 3, 3, 4, 5, 4, 1).sortWith(comparator1)
|
||||||
}
|
}
|
||||||
|
|
||||||
["replaceRange()"] {
|
["replaceRange()"] {
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ examples {
|
|||||||
List()
|
List()
|
||||||
List(1, 1, 1, 2, 3)
|
List(1, 1, 1, 2, 3)
|
||||||
List(1, 2, 3, 4, 5)
|
List(1, 2, 3, 4, 5)
|
||||||
|
List(0, 0, 1, 1, 2, 3, 3, 4, 4, 5)
|
||||||
}
|
}
|
||||||
["replaceRange()"] {
|
["replaceRange()"] {
|
||||||
List(1, 9, 8, 5)
|
List(1, 9, 8, 5)
|
||||||
|
|||||||
Reference in New Issue
Block a user