Elm Exactly
Results / elm-bytes /

EncodeUnsignedInt16BETest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Bytes.Encode.unsignedInt16` with big-endian order writes 2 bytes.

The test encodes `0x1234` and logs the width of the result.

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.
EncodeUnsignedInt16BETest: 2

elm-0.19.2

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

elm-0.19.3

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

lamdera-1.5.0

passran in 48 ms
Output
EncodeUnsignedInt16BETest: 2

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module EncodeUnsignedInt16BETest exposing (main)
{-| `Bytes.Encode.unsignedInt16` with big-endian order writes 2 bytes.
The test encodes `0x1234` and logs the width of the result.
-}
-- CHECK: EncodeUnsignedInt16BETest: 2
import Bytes exposing (Bytes, Endianness(..))
import Bytes.Encode as E
import Html exposing (text)
main =
let
bytes =
E.encode (E.unsignedInt16 BE 0x1234)
result =
Bytes.width bytes
_ =
Debug.log "EncodeUnsignedInt16BETest" result
in
text (String.fromInt result)