FromArrayFloatListCompareSortTest
`List.sort` orders a `List Float` that came out of an `Array` via `Array.fromList` and `Array.toList`. `[3.0, 1.0, 2.0]` sorts to `[1.0, 2.0, 3.0]`; the test logs the sorted list and compares it with the expected one.
Results
elm-0.19.1
passran in 78 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. sorted: [1,2,3] match: True
elm-0.19.2
passran in 79 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. sorted: [1,2,3] match: True
elm-0.19.3
passran in 37 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. sorted: [1,2,3] match: True
lamdera-1.5.0
passran in 71 msOutput
sorted: [1,2,3] match: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/FromArrayFloatListCompareSortTest] in its title.
Source
The -- CHECK: lines give the expected output.
module FromArrayFloatListCompareSortTest exposing (main)
{-| `List.sort` orders a `List Float` that came out of an `Array` via `Array.fromList` and `Array.toList`.
`[3.0, 1.0, 2.0]` sorts to `[1.0, 2.0, 3.0]`; the test logs the sorted list and compares it with the expected one.
-}
-- CHECK: sorted: [1,2,3]
-- CHECK: match: True
import Array
import Html exposing (text)
main =
let
arr = Array.fromList [3.0, 1.0, 2.0]
sorted = List.sort (Array.toList arr)
_ = Debug.log "sorted" sorted
_ = Debug.log "match" (sorted == [1.0, 2.0, 3.0])
in
text "done"