[libmath-prime-util-perl] 30/40: Fix case of forprimes with begin = 6 returning 5, and add test

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


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

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

commit 829acafbd21218fdd5e37513ffa370e3862e20af
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed Jul 24 17:18:30 2013 -0700

    Fix case of forprimes with begin = 6 returning 5, and add test
---
 XS.xs            | 2 +-
 t/32-iterators.t | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/XS.xs b/XS.xs
index 5953f31..24e81d5 100644
--- a/XS.xs
+++ b/XS.xs
@@ -754,7 +754,7 @@ forprimes (SV* block, IN SV* svbeg, IN SV* svend = 0)
     SAVESPTR(GvSV(PL_defgv));
     svarg = newSVuv(0);
     /* Handle early part */
-    while (beg < 7) {
+    while (beg < 6) {
       dSP;
       beg = (beg <= 2) ? 2 : (beg <= 3) ? 3 : 5; 
       if (beg <= end) {
diff --git a/t/32-iterators.t b/t/32-iterators.t
index 7e4ae1e..645c1d3 100644
--- a/t/32-iterators.t
+++ b/t/32-iterators.t
@@ -8,7 +8,7 @@ use Math::Prime::Util qw/primes forprimes prime_iterator/;
 my $use64 = Math::Prime::Util::prime_get_config->{'maxbits'} > 32;
 
 plan tests => 8 + 5
-            + 11
+            + 12
             + 3 + 7
             + 2;
 
@@ -32,6 +32,7 @@ ok(!eval { forprimes { 1 } 5.6; },   "forprimes abc");
 {my @t; forprimes {push @t,$_} 3,6; is_deeply( [@t], [3,5], "forprimes 3,6" ); }
 {my @t; forprimes {push @t,$_} 3,7; is_deeply( [@t], [3,5,7], "forprimes 3,7" ); }
 {my @t; forprimes {push @t,$_} 5,7; is_deeply( [@t], [5,7], "forprimes 5,7" ); }
+{my @t; forprimes {push @t,$_} 6,7; is_deeply( [@t], [7], "forprimes 6,7" ); }
 {my @t; forprimes {push @t,$_} 5,11; is_deeply( [@t], [5,7,11], "forprimes 5,11" ); }
 {my @t; forprimes {push @t,$_} 7,11; is_deeply( [@t], [7,11], "forprimes 7,11" ); }
 

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