Created
November 2, 2021 12:15
-
-
Save dogbert17/af79a02ec68dab2066ab58cb4d9c6711 to your computer and use it in GitHub Desktop.
Pathetic golf attempt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test; | |
for ^1000 { | |
subtest 'Complex smartmatch against Range' => { | |
my @false = [i, 1..10], [i, -2e300.Int..2e300.Int], [i, -2e300.Int..2e300.Int], | |
[<0+0i>, 1..10], [i, 'a'..Inf], [i, 'a'..'z']; | |
# these cases are true because the imaginary part is small enough that | |
# we can convert these Complex into Real | |
my @true = [<0+0i>, -1..10], [<42+0i>, 10..50], | |
[<42+0.0000000000000001i>, 40..50], [<42+0i>, 10e0..50e0]; | |
plan @false + @true; | |
for @false -> $t { | |
is-deeply ($t[0] ~~ $t[1]), False, "{$t[0].raku} ~~ {$t[1].raku}"; | |
} | |
for @true -> $t { | |
is-deeply ($t[0] ~~ $t[1]), True, "{$t[0].raku} ~~ {$t[1].raku}"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment