Elm Exactly
Results / elm-core /

CharAstralArrayTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
An astral `Char`, one whose code point is above 0xFFFF and so lies outside the
Basic Multilingual Plane, keeps its code point when stored in an `Array`.

The test pushes U+1F600 onto a two-element array, sets index 0 of that array to
U+1D11E, and sets index 5 of a 40-element array to U+1F600. `Array.get` returns
each code point, an untouched element of the large array is still `'a'`, and
the small array converted back to a `String` equals `"ab๐Ÿ˜€"`.

Results

elm-0.19.1

passran in 57 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
arr_push: Just 128512
arr_set_tail: Just 119070
arr_set_tree: Just 128512
arr_other: Just 97
arr_string_ok: True

elm-0.19.2

passran in 52 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
arr_push: Just 128512
arr_set_tail: Just 119070
arr_set_tree: Just 128512
arr_other: Just 97
arr_string_ok: True

elm-0.19.3

passran in 54 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
arr_push: Just 128512
arr_set_tail: Just 119070
arr_set_tree: Just 128512
arr_other: Just 97
arr_string_ok: True

lamdera-1.5.0

passran in 40 ms
Output
arr_push: Just 128512
arr_set_tail: Just 119070
arr_set_tree: Just 128512
arr_other: Just 97
arr_string_ok: True

Discussions

Discuss this testยทSearch the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module CharAstralArrayTest exposing (main)
{-| An astral `Char`, one whose code point is above 0xFFFF and so lies outside the
Basic Multilingual Plane, keeps its code point when stored in an `Array`.
The test pushes U+1F600 onto a two-element array, sets index 0 of that array to
U+1D11E, and sets index 5 of a 40-element array to U+1F600. `Array.get` returns
each code point, an untouched element of the large array is still `'a'`, and
the small array converted back to a `String` equals `"ab๐Ÿ˜€"`.
-}
-- CHECK: arr_push: Just 128512
-- CHECK: arr_set_tail: Just 119070
-- CHECK: arr_set_tree: Just 128512
-- CHECK: arr_other: Just 97
-- CHECK: arr_string_ok: True
import Array
import Html exposing (text)
main =
let
small =
Array.fromList [ 'a', 'b' ]
|> Array.push '๐Ÿ˜€'
tailSet =
Array.set 0 (Char.fromCode 0x0001D11E) small
big =
Array.initialize 40 (\_ -> 'a')
|> Array.set 5 '๐Ÿ˜€'
_ =
Debug.log "arr_push" (Maybe.map Char.toCode (Array.get 2 small))
_ =
Debug.log "arr_set_tail" (Maybe.map Char.toCode (Array.get 0 tailSet))
_ =
Debug.log "arr_set_tree" (Maybe.map Char.toCode (Array.get 5 big))
_ =
Debug.log "arr_other" (Maybe.map Char.toCode (Array.get 39 big))
_ =
Debug.log "arr_string_ok" (String.fromList (Array.toList small) == "ab๐Ÿ˜€")
in
text "done"