[libmath-prime-util-perl] 23/29: Adjust tests to work around Perl 5.6.2 quirks
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:48:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.27
in repository libmath-prime-util-perl.
commit b2b2191f6bb3325b98f6cf5bf5c7787d8f8f2879
Author: Dana Jacobsen <dana at acm.org>
Date: Sun May 19 00:14:44 2013 -0700
Adjust tests to work around Perl 5.6.2 quirks
---
t/23-primality-proofs.t | 25 +++++++++++++++----------
t/80-pp.t | 22 +++++++++++++++-------
2 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/t/23-primality-proofs.t b/t/23-primality-proofs.t
index d525fbe..ceefc4b 100644
--- a/t/23-primality-proofs.t
+++ b/t/23-primality-proofs.t
@@ -11,6 +11,7 @@ use Math::Prime::Util qw/is_prime is_provable_prime is_provable_prime_with_cert
use Math::BigInt try => 'GMP';
my $extra = defined $ENV{EXTENDED_TESTING} && $ENV{EXTENDED_TESTING};
+my $broken64 = (18446744073709550592 == ~0);
my @plist = qw/20907001 809120722675364249 677826928624294778921
980098182126316404630169387/;
@@ -47,16 +48,20 @@ is( is_provable_prime(1490266103), 2, "1490266103 is provably prime" );
foreach my $p (@plist) {
ok( is_prime($p), "$p is prime" );
- my($isp, $cert_ref) = is_provable_prime_with_cert($p);
- is( $isp, 2, " is_provable_prime_with_cert returns 2" );
- ok( defined($cert_ref) && ref($cert_ref) eq 'ARRAY' && scalar(@$cert_ref) >= 1,
- " certificate is non-null" );
- ok( verify_prime($cert_ref), " verification of certificate reference done" );
- # Note, in some cases the two certs could be non-equal (but both must be valid!)
- my @cert = prime_certificate($p);
- ok( scalar(@cert) >= 1, " prime_certificate is also non-null" );
- # TODO: compare certificates and skip if equal
- ok( verify_prime(@cert), " verification of prime_certificate done" );
+ SKIP: {
+ skip "Broken 64-bit causes trial factor to barf", 5
+ if $broken64 && $p > 2**48;
+ my($isp, $cert_ref) = is_provable_prime_with_cert($p);
+ is( $isp, 2, " is_provable_prime_with_cert returns 2" );
+ ok( defined($cert_ref) && ref($cert_ref) eq 'ARRAY' && scalar(@$cert_ref) >= 1,
+ " certificate is non-null" );
+ ok( verify_prime($cert_ref), " verification of certificate reference done" );
+ # Note, in some cases the two certs could be non-equal (but both must be valid!)
+ my @cert = prime_certificate($p);
+ ok( scalar(@cert) >= 1, " prime_certificate is also non-null" );
+ # TODO: compare certificates and skip if equal
+ ok( verify_prime(@cert), " verification of prime_certificate done" );
+ }
}
# Some hand-done proofs
diff --git a/t/80-pp.t b/t/80-pp.t
index 3918760..f75607f 100644
--- a/t/80-pp.t
+++ b/t/80-pp.t
@@ -566,13 +566,21 @@ SKIP: {
is_deeply( [Math::Prime::Util::PP::primality_proof_lucas(100003)],
[2, [100003, "Pratt", [2, 3, 7, 2381], 2]],
"primality_proof_lucas(100003)" );
-is_deeply( [Math::Prime::Util::PP::primality_proof_bls75(210596120454733723)],
- [2, [210596120454733723, "n-1", [2, 3, 82651, 47185492693], [2, 2, 2, 2]]],
- "primality_proof_bls75(210596120454733723)" );
-is_deeply( [Math::Prime::Util::PP::primality_proof_bls75(809120722675364249)],
- [2, [809120722675364249, "n-1",
- ["B", 20000, 22233477760919, 2], [2, 4549], [3, 2]]],
- "primality_proof_bls75(809120722675364249)" );
+# Had to reduce these to make borked up Perl 5.6.2 work.
+#is_deeply( [Math::Prime::Util::PP::primality_proof_bls75("210596120454733723")],
+# [2, ["210596120454733723", "n-1", [2, 3, 82651, "47185492693"], [2, 2, 2, 2]]],
+# "primality_proof_bls75(210596120454733723)" );
+#is_deeply( [Math::Prime::Util::PP::primality_proof_bls75("809120722675364249")],
+# [2, ["809120722675364249", "n-1",
+# ["B", 20000, "22233477760919", 2], [2, 4549], [3, 2]]],
+# "primality_proof_bls75(809120722675364249)" );
+is_deeply( [Math::Prime::Util::PP::primality_proof_bls75(1490266103)],
+ [2, [1490266103, 'n-1', [2, 13, 19, 1597, 1889], [5, 2, 2, 2, 2]]],
+ "primality_proof_bls75(1490266103)" );
+is_deeply( [Math::Prime::Util::PP::primality_proof_bls75("64020974585221")],
+ [2, ["64020974585221", "n-1",
+ ["B", 20000, "5154667841", 2], [2, 3, 5, 23], [2, 2, 2, 2]]],
+ "primality_proof_bls75(64020974585221)" );
{
my $n = Math::BigInt->new("168790877523676911809192454171451");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list