ListToArrayCharRoundtripTest
Converting a `List Char` to an array with `Array.fromList` and back with `Array.toList` gives the original list. The test prints the round-tripped list and whether it is `==` to the original `['a','b','c']`.
Results
elm-0.19.1
passran in 67 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: ['a','b','c'] match: True
elm-0.19.2
passran in 69 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. result: ['a','b','c'] match: True
elm-0.19.3
passran in 71 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. match: True result: ['a','b','c']
lamdera-1.5.0
passran in 65 msOutput
match: True result: ['a','b','c']
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListToArrayCharRoundtripTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListToArrayCharRoundtripTest exposing (main)
{-| Converting a `List Char` to an array with `Array.fromList` and back with `Array.toList` gives the original list.
The test prints the round-tripped list and whether it is `==` to the original `['a','b','c']`.
-}
-- CHECK: result: ['a','b','c']
-- CHECK: match: True
import Array
import Html exposing (text)
main =
let
xs =
[ 'a', 'b', 'c' ]
result =
Array.toList (Array.fromList xs)
_ =
Debug.log "result" result
_ =
Debug.log "match" (result == xs)
in
text "done"