Elm Exactly
Results / elm-parser /

ParserOctalBinaryIntTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks that `Parser.number` reads octal and binary integer literals.

`"0o777"` gives `Ok 511` and `"0b1010"` gives `Ok 10`. Hexadecimal and float
forms are disabled in the configuration and not exercised.

Results

elm-0.19.1

passran in 92 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
octal: Ok 511
binary: Ok 10

elm-0.19.2

passran in 68 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
octal: Ok 511
binary: Ok 10

elm-0.19.3

passran in 76 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
octal: Ok 511
binary: Ok 10

lamdera-1.5.0

passran in 37 ms
Output
octal: Ok 511
binary: Ok 10

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ParserOctalBinaryIntTest exposing (main)
{-| Checks that `Parser.number` reads octal and binary integer literals.
`"0o777"` gives `Ok 511` and `"0b1010"` gives `Ok 10`. Hexadecimal and float
forms are disabled in the configuration and not exercised.
-}
-- CHECK: octal: Ok 511
-- CHECK: binary: Ok 10
import Html exposing (text)
import Parser
myNum : Parser.Parser Int
myNum =
Parser.number
{ int = Just identity
, hex = Nothing
, octal = Just identity
, binary = Just identity
, float = Nothing
}
main =
let
_ = Debug.log "octal" (Parser.run myNum "0o777")
_ = Debug.log "binary" (Parser.run myNum "0b1010")
in
text "done"