Elm Exactly
Results / elm-json /

RoundTripNegativeIntTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
The negative integer -7 encoded with `Json.Encode.int` decodes back to -7 with `Json.Decode.int`.

Results

elm-0.19.1

passran in 55 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
rt_neg_int: Ok -7

elm-0.19.2

passran in 56 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
rt_neg_int: Ok -7

elm-0.19.3

passran in 43 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
rt_neg_int: Ok -7

lamdera-1.5.0

passran in 56 ms
Output
rt_neg_int: Ok -7

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-json/RoundTripNegativeIntTest] in its title.

Source

The -- CHECK: lines give the expected output.

module RoundTripNegativeIntTest exposing (main)
{-| The negative integer -7 encoded with `Json.Encode.int` decodes back to -7 with `Json.Decode.int`.
-}
-- CHECK: rt_neg_int: Ok -7
import Html exposing (text)
import Json.Decode as Decode
import Json.Encode as Encode
main =
let
_ = Debug.log "rt_neg_int" (Decode.decodeString Decode.int (Encode.encode 0 (Encode.int -7)))
in
text "done"