ListToArrayFloatRoundtripTest
Converting a `List Float` to an `Array` with `Array.fromList` and back with `Array.toList` returns a list equal to the original. The list is `[ 1.5, 2.5, 3.5 ]`. The test logs the round-tripped list and whether it is `==` to the original.
Results
elm-0.19.1
passran in 90 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: [1.5,2.5,3.5] match: True
elm-0.19.2
passran in 50 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. result: [1.5,2.5,3.5] match: True
elm-0.19.3
passran in 42 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: [1.5,2.5,3.5]
lamdera-1.5.0
passran in 73 msOutput
match: True result: [1.5,2.5,3.5]
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListToArrayFloatRoundtripTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListToArrayFloatRoundtripTest exposing (main)
{-| Converting a `List Float` to an `Array` with `Array.fromList` and back with
`Array.toList` returns a list equal to the original.
The list is `[ 1.5, 2.5, 3.5 ]`. The test logs the round-tripped list and
whether it is `==` to the original.
-}
-- CHECK: result: [1.5,2.5,3.5]
-- CHECK: match: True
import Array
import Html exposing (text)
main =
let
xs =
[ 1.5, 2.5, 3.5 ]
result =
Array.toList (Array.fromList xs)
_ =
Debug.log "result" result
_ =
Debug.log "match" (result == xs)
in
text "done"