DecodeUnsignedInt8Test
Bytes.Decode.unsignedInt8 reads back a byte written by Bytes.Encode.unsignedInt8. The byte 42 is encoded and decoded, and the logged result is 42. A failed decode would log -1.
Results
elm-0.19.1
passran in 51 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. DecodeUnsignedInt8Test: 42
elm-0.19.2
passran in 46 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. DecodeUnsignedInt8Test: 42
elm-0.19.3
passran in 67 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. DecodeUnsignedInt8Test: 42
lamdera-1.5.0
passran in 72 msOutput
DecodeUnsignedInt8Test: 42
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-bytes/DecodeUnsignedInt8Test] in its title.
Source
The -- CHECK: lines give the expected output.
module DecodeUnsignedInt8Test exposing (main)
{-| Bytes.Decode.unsignedInt8 reads back a byte written by Bytes.Encode.unsignedInt8.
The byte 42 is encoded and decoded, and the logged result is 42. A failed
decode would log -1.
-}
-- CHECK: DecodeUnsignedInt8Test: 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.unsignedInt8 42)
result =
D.decode D.unsignedInt8 bytes
|> Maybe.withDefault -1
_ =
Debug.log "DecodeUnsignedInt8Test" result
in
text (String.fromInt result)