mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 21:40:58 +00:00
Update test fixtures to not use Nat indices
This commit is contained in:
parent
70a1def63b
commit
7e51dfd526
8 changed files with 62 additions and 62 deletions
|
|
@ -1,6 +1,6 @@
|
|||
app "quicksort" provides [swap, partition, partitionHelp, quicksort] to "./platform"
|
||||
|
||||
quicksort : List (Num a), Nat, Nat -> List (Num a)
|
||||
quicksort : List (Num a), U64, U64 -> List (Num a)
|
||||
quicksort = \list, low, high ->
|
||||
when partition low high list is
|
||||
Pair partitionIndex partitioned ->
|
||||
|
|
@ -9,7 +9,7 @@ quicksort = \list, low, high ->
|
|||
|> quicksort (partitionIndex + 1) high
|
||||
|
||||
|
||||
swap : Nat, Nat, List a -> List a
|
||||
swap : U64, U64, List a -> List a
|
||||
swap = \i, j, list ->
|
||||
when Pair (List.get list i) (List.get list j) is
|
||||
Pair (Ok atI) (Ok atJ) ->
|
||||
|
|
@ -21,7 +21,7 @@ swap = \i, j, list ->
|
|||
[]
|
||||
|
||||
|
||||
partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]
|
||||
partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))]
|
||||
partition = \low, high, initialList ->
|
||||
when List.get initialList high is
|
||||
Ok pivot ->
|
||||
|
|
@ -33,7 +33,7 @@ partition = \low, high, initialList ->
|
|||
Pair (low - 1) initialList
|
||||
|
||||
|
||||
partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))]
|
||||
partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))]
|
||||
partitionHelp = \i, j, list, high, pivot ->
|
||||
if j < high then
|
||||
when List.get list j is
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
app "quicksort" provides [quicksort] to "./platform"
|
||||
|
||||
quicksortHelp : List (Num a), Nat, Nat -> List (Num a)
|
||||
quicksortHelp : List (Num a), U64, U64 -> List (Num a)
|
||||
quicksortHelp = \list, low, high ->
|
||||
if low < high then
|
||||
when partition low high list is
|
||||
|
|
@ -12,7 +12,7 @@ quicksortHelp = \list, low, high ->
|
|||
list
|
||||
|
||||
|
||||
swap : Nat, Nat, List a -> List a
|
||||
swap : U64, U64, List a -> List a
|
||||
swap = \i, j, list ->
|
||||
when Pair (List.get list i) (List.get list j) is
|
||||
Pair (Ok atI) (Ok atJ) ->
|
||||
|
|
@ -23,7 +23,7 @@ swap = \i, j, list ->
|
|||
_ ->
|
||||
[]
|
||||
|
||||
partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]
|
||||
partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))]
|
||||
partition = \low, high, initialList ->
|
||||
when List.get initialList high is
|
||||
Ok pivot ->
|
||||
|
|
@ -35,7 +35,7 @@ partition = \low, high, initialList ->
|
|||
Pair (low - 1) initialList
|
||||
|
||||
|
||||
partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))]
|
||||
partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))]
|
||||
partitionHelp = \i, j, list, high, pivot ->
|
||||
if j < high then
|
||||
when List.get list j is
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ interface Quicksort
|
|||
exposes [swap, partition, quicksort]
|
||||
imports []
|
||||
|
||||
quicksort : List (Num a), Nat, Nat -> List (Num a)
|
||||
quicksort : List (Num a), U64, U64 -> List (Num a)
|
||||
quicksort = \list, low, high ->
|
||||
when partition low high list is
|
||||
Pair partitionIndex partitioned ->
|
||||
|
|
@ -11,7 +11,7 @@ quicksort = \list, low, high ->
|
|||
|> quicksort (partitionIndex + 1) high
|
||||
|
||||
|
||||
swap : Nat, Nat, List a -> List a
|
||||
swap : U64, U64, List a -> List a
|
||||
swap = \i, j, list ->
|
||||
when Pair (List.get list i) (List.get list j) is
|
||||
Pair (Ok atI) (Ok atJ) ->
|
||||
|
|
@ -23,7 +23,7 @@ swap = \i, j, list ->
|
|||
[]
|
||||
|
||||
|
||||
partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]
|
||||
partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))]
|
||||
partition = \low, high, initialList ->
|
||||
when List.get initialList high is
|
||||
Ok pivot ->
|
||||
|
|
@ -35,7 +35,7 @@ partition = \low, high, initialList ->
|
|||
Pair (low - 1) initialList
|
||||
|
||||
|
||||
partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))]
|
||||
partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))]
|
||||
partitionHelp = \i, j, list, high, pivot ->
|
||||
if j < high then
|
||||
when List.get list j is
|
||||
|
|
|
|||
|
|
@ -465,10 +465,10 @@ fn iface_quicksort() {
|
|||
expect_types(
|
||||
loaded_module,
|
||||
hashmap! {
|
||||
"swap" => "Nat, Nat, List a -> List a",
|
||||
"partition" => "Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]",
|
||||
"partitionHelp" => "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]",
|
||||
"quicksort" => "List (Num a), Nat, Nat -> List (Num a)",
|
||||
"swap" => "U64, U64, List a -> List a",
|
||||
"partition" => "U64, U64, List (Num a) -> [Pair U64 (List (Num a))]",
|
||||
"partitionHelp" => "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]",
|
||||
"quicksort" => "List (Num a), U64, U64 -> List (Num a)",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -481,10 +481,10 @@ fn quicksort_one_def() {
|
|||
expect_types(
|
||||
loaded_module,
|
||||
hashmap! {
|
||||
"swap" => "Nat, Nat, List a -> List a",
|
||||
"partition" => "Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]",
|
||||
"partitionHelp" => "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]",
|
||||
"quicksortHelp" => "List (Num a), Nat, Nat -> List (Num a)",
|
||||
"swap" => "U64, U64, List a -> List a",
|
||||
"partition" => "U64, U64, List (Num a) -> [Pair U64 (List (Num a))]",
|
||||
"partitionHelp" => "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]",
|
||||
"quicksortHelp" => "List (Num a), U64, U64 -> List (Num a)",
|
||||
"quicksort" => "List (Num a) -> List (Num a)",
|
||||
},
|
||||
);
|
||||
|
|
@ -498,10 +498,10 @@ fn app_quicksort() {
|
|||
expect_types(
|
||||
loaded_module,
|
||||
hashmap! {
|
||||
"swap" => "Nat, Nat, List a -> List a",
|
||||
"partition" => "Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]",
|
||||
"partitionHelp" => "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]",
|
||||
"quicksort" => "List (Num a), Nat, Nat -> List (Num a)",
|
||||
"swap" => "U64, U64, List a -> List a",
|
||||
"partition" => "U64, U64, List (Num a) -> [Pair U64 (List (Num a))]",
|
||||
"partitionHelp" => "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]",
|
||||
"quicksort" => "List (Num a), U64, U64 -> List (Num a)",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue