Elm Exactly
Results / elm-bytes /

EncodeStringTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Bytes.Encode.string` writes one byte per ASCII character.

The test encodes `"hello"` and logs the width of the result, 5.

Results

elm-0.19.1

passran in 68 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
EncodeStringTest: 5

elm-0.19.2

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

elm-0.19.3

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

lamdera-1.5.0

passran in 37 ms
Output
EncodeStringTest: 5

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module EncodeStringTest exposing (main)
{-| `Bytes.Encode.string` writes one byte per ASCII character.
The test encodes `"hello"` and logs the width of the result, 5.
-}
-- CHECK: EncodeStringTest: 5
import Bytes exposing (Bytes)
import Bytes.Encode as E
import Html exposing (text)
main =
let
bytes =
E.encode (E.string "hello")
result =
Bytes.width bytes
_ =
Debug.log "EncodeStringTest" result
in
text (String.fromInt result)