EncodeUnsignedInt16LETest
`Bytes.Encode.unsignedInt16` with little-endian order writes 2 bytes. The test encodes `0x1234` and logs the width of the result.
Results
elm-0.19.1
passran in 66 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. EncodeUnsignedInt16LETest: 2
elm-0.19.2
passran in 63 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. EncodeUnsignedInt16LETest: 2
elm-0.19.3
passran in 47 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. EncodeUnsignedInt16LETest: 2
lamdera-1.5.0
passran in 53 msOutput
EncodeUnsignedInt16LETest: 2
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-bytes/EncodeUnsignedInt16LETest] in its title.
Source
The -- CHECK: lines give the expected output.
module EncodeUnsignedInt16LETest exposing (main)
{-| `Bytes.Encode.unsignedInt16` with little-endian order writes 2 bytes.
The test encodes `0x1234` and logs the width of the result.
-}
-- CHECK: EncodeUnsignedInt16LETest: 2
import Bytes exposing (Bytes, Endianness(..))
import Bytes.Encode as E
import Html exposing (text)
main =
let
bytes =
E.encode (E.unsignedInt16 LE 0x1234)
result =
Bytes.width bytes
_ =
Debug.log "EncodeUnsignedInt16LETest" result
in
text (String.fromInt result)