RoundTripIntTest
The integer 42 encoded with `Json.Encode.int` decodes back to 42 with `Json.Decode.int`.
Results
elm-0.19.1
passran in 66 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. rt_int: Ok 42
elm-0.19.2
passran in 51 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. rt_int: Ok 42
elm-0.19.3
passran in 36 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. rt_int: Ok 42
lamdera-1.5.0
passran in 72 msOutput
rt_int: Ok 42
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-json/RoundTripIntTest] in its title.
Source
The -- CHECK: lines give the expected output.
module RoundTripIntTest exposing (main)
{-| The integer 42 encoded with `Json.Encode.int` decodes back to 42 with `Json.Decode.int`.
-}
-- CHECK: rt_int: Ok 42
import Html exposing (text)
import Json.Decode as Decode
import Json.Encode as Encode
main =
let
_ = Debug.log "rt_int" (Decode.decodeString Decode.int (Encode.encode 0 (Encode.int 42)))
in
text "done"