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