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