[libmath-prime-util-perl] 05/05: Patch up silly MPU::GMP cert mistake

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:49:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.31
in repository libmath-prime-util-perl.

commit 5d5534cfadc00d4bd2ea582c1e78f9ab371dc7e1
Author: Dana Jacobsen <dana at acm.org>
Date:   Tue Aug 6 22:51:41 2013 -0700

    Patch up silly MPU::GMP cert mistake
---
 Changes                 | 5 ++++-
 README                  | 2 +-
 lib/Math/Prime/Util.pm  | 9 +++++++--
 t/23-primality-proofs.t | 6 ++++--
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/Changes b/Changes
index 3f6ab5e..9a8133d 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,6 @@
 Revision history for Perl module Math::Prime::Util
 
-0.31  2013-08-06
+0.31  2013-08-07
 
     - Change proof certificate documentation to reflect the new text format.
 
@@ -9,6 +9,9 @@ Revision history for Perl module Math::Prime::Util
 
     - Small speedup for ranged totient internals.
 
+    - Patch MPU::GMP 0.13 giving us not quite what we expected from a small
+      certificate.  Fixed in MPU::GMP 0.14, worked around here regardless.
+
 0.30  2013-08-06
 
     [API Changes]
diff --git a/README b/README
index 9356a21..8f2cf60 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Math::Prime::Util version 0.30
+Math::Prime::Util version 0.31
 
 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/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 06ecc71..efce890 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1768,7 +1768,12 @@ sub is_provable_prime_with_cert {
   if ($_HAVE_GMP && defined &Math::Prime::Util::GMP::is_provable_prime_with_cert) {
     my ($isp, $cert) = Math::Prime::Util::GMP::is_provable_prime_with_cert($n);
     # New version that returns string format.
-    return ($isp, $cert) if ref($cert) ne 'ARRAY';
+    #return ($isp, $cert) if ref($cert) ne 'ARRAY';
+    if (ref($cert) ne 'ARRAY') {
+      # Fix silly 0.13 mistake (TODO: deprecate this)
+      $cert =~ s/^Type Small\n(\d+)/Type Small\nN $1/smg;
+      return ($isp, $cert);
+    }
     # Old version.  Convert.
     if (!defined $Math::Prime::Util::PrimalityProving::VERSION) {
       eval { require Math::Prime::Util::PrimalityProving; 1; }
@@ -2186,7 +2191,7 @@ Math::Prime::Util - Utilities related to prime numbers, including fast sieves an
 
 =head1 VERSION
 
-Version 0.30
+Version 0.31
 
 
 =head1 SYNOPSIS
diff --git a/t/23-primality-proofs.t b/t/23-primality-proofs.t
index 6a0fbc8..70e4a62 100644
--- a/t/23-primality-proofs.t
+++ b/t/23-primality-proofs.t
@@ -6,7 +6,7 @@ use Test::More;
 use Test::Warn;
 use Math::Prime::Util qw/is_prime is_provable_prime is_provable_prime_with_cert
                          prime_certificate verify_prime
-                         prime_get_config
+                         prime_get_config prime_set_config
                         /;
 use Math::BigInt try => 'GMP';
 
@@ -58,7 +58,9 @@ foreach my $p (@plist) {
     is( $isp, 2, "   is_provable_prime_with_cert returns 2" );
     ok( defined($cert) && $cert =~ /^Type/m,
         "   certificate is non-null" );
-    ok( verify_prime($cert), "   verification of certificate done" );
+    prime_set_config(verbose=>1);
+    ok( verify_prime($cert), "   verification of certificate for $p done" );
+    prime_set_config(verbose=>0);
     # Note, in some cases the two certs could be non-equal (but both must be valid!)
     my $cert2 = prime_certificate($p);
     ok( defined($cert2) && $cert2 =~ /^Type/m,

-- 
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