Elm Exactly
Results / elm-bytes /

DecodeSignedInt8Test

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

The value -42 is encoded as one byte and decoded, and the logged result is -42.
A failed decode would log 0.

Results

elm-0.19.1

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

elm-0.19.2

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

elm-0.19.3

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

lamdera-1.5.0

passran in 53 ms
Output
DecodeSignedInt8Test: -42

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

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