BitwiseIdentityTest
`Bitwise.and` and `Bitwise.or` of a number with itself return the number, and `Bitwise.xor` of a number with itself returns 0.
Results
elm-0.19.1
passran in 79 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. identity1: 42 identity2: 42 identity3: 0
elm-0.19.2
passran in 59 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. identity1: 42 identity2: 42 identity3: 0
elm-0.19.3
passran in 43 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. identity3: 0 identity2: 42 identity1: 42
lamdera-1.5.0
passran in 54 msOutput
identity3: 0 identity2: 42 identity1: 42
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/BitwiseIdentityTest] in its title.
Source
The -- CHECK: lines give the expected output.
module BitwiseIdentityTest exposing (main)
{-| `Bitwise.and` and `Bitwise.or` of a number with itself return the number, and `Bitwise.xor` of a number with itself returns 0.
-}
-- CHECK: identity1: 42
-- CHECK: identity2: 42
-- CHECK: identity3: 0
import Bitwise
import Html exposing (text)
main =
let
x = 42
_ = Debug.log "identity1" (Bitwise.and x x)
_ = Debug.log "identity2" (Bitwise.or x x)
_ = Debug.log "identity3" (Bitwise.xor x x)
in
text "done"