This is an automated email from the git hooks/post-receive script. ppm-guest pushed a commit to annotated tag v0.15 in repository libmath-prime-util-perl.
commit 6e7e3bff39fde98a366ac06b290e21556a761914 Author: Dana Jacobsen <d...@acm.org> Date: Sun Dec 9 06:26:09 2012 -0800 Update tests for new functions, and Perl 5.6.2 workarounds --- README | 2 +- TODO | 2 -- t/16-randomprime.t | 5 +---- t/19-moebius.t | 2 ++ t/20-primorial.t | 16 ++++++++++++---- t/81-bignum.t | 11 +++++++---- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/README b/README index c529e8a..2544f01 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Math::Prime::Util version 0.14 +Math::Prime::Util version 0.15 A set of utilities related to prime numbers. These include multiple sieving methods, is_prime, prime_count, nth_prime, approximations and bounds for diff --git a/TODO b/TODO index 1a7c625..c97cc81 100644 --- a/TODO +++ b/TODO @@ -40,5 +40,3 @@ - Dynamically use a mulmodadd in PP aks, just like the new C code does. This will mean it'll work for full-size native ints. - -- RANDBITS in random primes. diff --git a/t/16-randomprime.t b/t/16-randomprime.t index 6ab84bf..22664ee 100644 --- a/t/16-randomprime.t +++ b/t/16-randomprime.t @@ -57,7 +57,7 @@ my %range_edge_empty = ( "3842610774 to 3842611108" => [], ); -plan tests => 13+4+4+4 +plan tests => 13+3+3+3 + (1 * scalar (keys %range_edge_empty)) + (3 * scalar (keys %range_edge)) + (2 * scalar (keys %ranges)) @@ -86,17 +86,14 @@ ok(!eval { random_prime(-$infinity); }, "random_prime(-infinity)"); ok(!eval { random_ndigit_prime(undef); }, "random_ndigit_prime(undef)"); ok(!eval { random_ndigit_prime(0); }, "random_ndigit_prime(0)"); ok(!eval { random_ndigit_prime(-5); }, "random_ndigit_prime(-5)"); -ok(!eval { random_ndigit_prime(50); }, "random_ndigit_prime(50)"); ok(!eval { random_nbit_prime(undef); }, "random_nbit_prime(undef)"); ok(!eval { random_nbit_prime(0); }, "random_nbit_prime(0)"); ok(!eval { random_nbit_prime(-5); }, "random_nbit_prime(-5)"); -ok(!eval { random_nbit_prime(130); }, "random_nbit_prime(130)"); ok(!eval { random_maurer_prime(undef); }, "random_maurer_prime(undef)"); ok(!eval { random_maurer_prime(0); }, "random_maurer_prime(0)"); ok(!eval { random_maurer_prime(-5); }, "random_maurer_prime(-5)"); -ok(!eval { random_maurer_prime(130); }, "random_maurer_prime(130)"); while (my($range, $expect) = each (%range_edge_empty)) { my($low,$high) = $range =~ /(\d+) to (\d+)/; diff --git a/t/19-moebius.t b/t/19-moebius.t index 3447e2b..41a8564 100644 --- a/t/19-moebius.t +++ b/t/19-moebius.t @@ -6,6 +6,8 @@ use Test::More; use Math::Prime::Util qw/moebius euler_phi jordan_totient divisor_sum/; my $use64 = Math::Prime::Util::prime_get_config->{'maxbits'} > 32; +my $broken64 = (18446744073709550592 == ~0); +$use64 = 0 if $broken64; my @moeb_vals = (qw/ 1 -1 -1 0 -1 1 -1 0 0 1 -1 0 -1 1 1 0 -1 0 -1 0 /); my %mertens = ( diff --git a/t/20-primorial.t b/t/20-primorial.t index 3546610..4a59722 100644 --- a/t/20-primorial.t +++ b/t/20-primorial.t @@ -5,6 +5,8 @@ use warnings; use Test::More; use Math::Prime::Util qw/primorial pn_primorial/; +my $broken64 = (18446744073709550592 == ~0); + my @pn_primorials = qw/ 1 2 @@ -65,15 +67,21 @@ sub nth_prime { # First we test native numbers foreach my $n (0 .. $#small_primorials) { - is( primorial(nth_prime($n)), $pn_primorials[$n], "primorial(nth($n))" ); - is( pn_primorial($n), $pn_primorials[$n], "pn_primorial($n)" ); + SKIP: { + skip "Broken 64-bit again...", 2 if $broken64 && $n >= 14 && $n <= 15; + is( primorial(nth_prime($n)), $pn_primorials[$n], "primorial(nth($n))" ); + is( pn_primorial($n), $pn_primorials[$n], "pn_primorial($n)" ); + } } # Then load up BigInt and make sure everything works for big numbers require Math::BigInt; foreach my $n (0 .. $#pn_primorials) { - is( primorial(nth_prime($n)), $pn_primorials[$n], "primorial(nth($n))" ); - is( pn_primorial($n), $pn_primorials[$n], "pn_primorial($n)" ); + SKIP: { + skip "Broken 64-bit again...", 2 if $broken64 && $n >= 14 && $n <= 15; + is( primorial(nth_prime($n)), $pn_primorials[$n], "primorial(nth($n))" ); + is( pn_primorial($n), $pn_primorials[$n], "pn_primorial($n)" ); + } } diff --git a/t/81-bignum.t b/t/81-bignum.t index 45a7179..719ab90 100644 --- a/t/81-bignum.t +++ b/t/81-bignum.t @@ -204,10 +204,13 @@ cmp_ok( $randprime, '>', 2**79, "random 80-bit prime isn't too small"); cmp_ok( $randprime, '<', 2**80, "random 80-bit prime isn't too big"); ok( is_prime($randprime), "random 80-bit prime is prime"); -$randprime = random_maurer_prime(80); -cmp_ok( $randprime, '>', 2**79, "random 80-bit Maurer prime isn't too small"); -cmp_ok( $randprime, '<', 2**80, "random 80-bit Maurer prime isn't too big"); -ok( is_prime($randprime), "random 80-bit Maurer prime is prime"); +SKIP: { + skip "Your 64-bit Perl is broken, skipping maurer prime", 3 if $broken64; + $randprime = random_maurer_prime(80); + cmp_ok( $randprime, '>', 2**79, "random 80-bit Maurer prime isn't too small"); + cmp_ok( $randprime, '<', 2**80, "random 80-bit Maurer prime isn't too big"); + ok( is_prime($randprime), "random 80-bit Maurer prime is prime"); +} ############################################################################### -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits