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