Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a lot of tests for 45724385972894572891.is-prime, because it
is showing inconsistent results on my Rakudo build.
  • Loading branch information
colomon committed Feb 17, 2013
1 parent 38dd58f commit 658c88c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion S32-num/is-prime.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 27;
plan 35;

# L<S32::Numeric/Numeric/"=item is-prime">

Expand All @@ -10,13 +10,27 @@ Basic tests for the is-prime() builtin
=end pod

# I know the all the 45724385972894572891 tests seem repetitious, but
# I am seeing inconsistent results on my Rakudo build, and I am hoping
# these repeated tests might help track it down.

nok 45724385972894572891.is-prime, "45724385972894572891 is not prime";
nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";

This comment has been minimized.

Copy link
@code-hunger

code-hunger Feb 9, 2020

Why not use a postfix for ^4 instead, then?

nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";
nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";

is (1..100).grep(*.is-prime),
(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97),
"Method form gets primes < 100 correct";
is (1..100).grep({ is-prime($_) }),
(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97),
"Sub form gets primes < 100 correct";

nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";
nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";
nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";
nok 45724385972894572891.is-prime, "45724385972894572891 is still not prime";

for (2801, 104743, 105517, 1300129, 15485867, 179424691, 32416187773) -> $prime {
ok $prime.is-prime, "$prime is a prime (method)";
ok is-prime($prime), "$prime is a prime (sub)";
Expand Down

0 comments on commit 658c88c

Please sign in to comment.