[libmath-prime-util-perl] 08/13: Change tests for next/prev 0..3572 to do 2 tests instead of 7146. Speeds up a lot, and in theory should give us the same debug info
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:45:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.11
in repository libmath-prime-util-perl.
commit 69150769cead038cf2ab26a7f76273e7e70ead2e
Author: Dana Jacobsen <dana at acm.org>
Date: Sun Jul 22 17:55:13 2012 -0600
Change tests for next/prev 0..3572 to do 2 tests instead of 7146. Speeds up a lot, and in theory should give us the same debug info
---
t/12-nextprime.t | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/t/12-nextprime.t b/t/12-nextprime.t
index 9db936d..69a1156 100644
--- a/t/12-nextprime.t
+++ b/t/12-nextprime.t
@@ -8,7 +8,7 @@ use Math::Prime::Util qw/next_prime prev_prime/;
my $use64 = Math::Prime::Util::prime_get_config->{'maxbits'} > 32;
my $extra = defined $ENV{RELEASE_TESTING} && $ENV{RELEASE_TESTING};
-plan tests => 3573*2 + 3*2 + 6 + 2 + 148 + 148 + 1;
+plan tests => 2 + 3*2 + 6 + 2 + 148 + 148 + 1;
my @small_primes = qw/
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71
@@ -45,12 +45,18 @@ my @small_primes = qw/
# Now test next_prime and prev_prime for all numbers 0 to 3572
my $prev_index = 0;
my $next_index = 1;
+ # We'll collect them here
+ my(@got_next, @got_prev, @exp_next, @exp_prev);
foreach my $n (0 .. 3572) {
$next_index++ if $n >= $small_primes[$next_index];
$prev_index++ if $n > $small_primes[$prev_index+1];
- is(next_prime($n), $small_primes[$next_index], "next_prime($n) == $small_primes[$next_index]");
- is(prev_prime($n), $small_primes[$prev_index], "prev_prime($n) == $small_primes[$prev_index]");
+ push @got_next, next_prime($n);
+ push @got_prev, prev_prime($n);
+ push @exp_next, $small_primes[$next_index];
+ push @exp_prev, $small_primes[$prev_index];
}
+ is_deeply( \@got_next, \@exp_next, "next_prime 0 .. 3572" );
+ is_deeply( \@got_prev, \@exp_prev, "prev_prime 0 .. 3572" );
}
my %primegaps = (
--
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