Elm Exactly
Results / elm-bytes /

DecodeSignedInt32BETest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Bytes.Decode.signedInt32 BE reads back a negative value written by
Bytes.Encode.signedInt32 BE.

The value -100000 is encoded and decoded big-endian, and the logged result is
-100000. A failed decode would log 0.

Results

elm-0.19.1

passran in 58 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
DecodeSignedInt32BETest: -100000

elm-0.19.2

passran in 45 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
DecodeSignedInt32BETest: -100000

elm-0.19.3

passran in 65 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
DecodeSignedInt32BETest: -100000

lamdera-1.5.0

passran in 49 ms
Output
DecodeSignedInt32BETest: -100000

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module DecodeSignedInt32BETest exposing (main)
{-| Bytes.Decode.signedInt32 BE reads back a negative value written by
Bytes.Encode.signedInt32 BE.
The value -100000 is encoded and decoded big-endian, and the logged result is
-100000. A failed decode would log 0.
-}
-- CHECK: DecodeSignedInt32BETest: -100000
import Bytes exposing (Bytes, Endianness(..))
import Bytes.Decode as D
import Bytes.Encode as E
import Html exposing (text)
main =
let
bytes =
E.encode (E.signedInt32 BE -100000)
result =
D.decode (D.signedInt32 BE) bytes
|> Maybe.withDefault 0
_ =
Debug.log "DecodeSignedInt32BETest" result
in
text (String.fromInt result)