[libmath-prime-util-perl] 12/13: Add xt test to do exhaustive small is/next/prev tests

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


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

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

commit 5226574b40950b806e7f6499094a0f064095835f
Author: Dana Jacobsen <dana at acm.org>
Date:   Sun Mar 10 19:19:06 2013 -0700

    Add xt test to do exhaustive small is/next/prev tests
---
 MANIFEST                 |  1 +
 xt/small-is-next-prev.pl | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/MANIFEST b/MANIFEST
index 739086d..6ff97b3 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -88,6 +88,7 @@ xt/moebius-mertens.pl
 xt/totient-range.pl
 xt/primality-small.pl
 xt/primality-aks.pl
+xt/small-is-next-prev.pl
 xt/factor-holf.pl
 xt/make-script-test-data.pl
 xt/pari-totient-moebius.pl
diff --git a/xt/small-is-next-prev.pl b/xt/small-is-next-prev.pl
new file mode 100755
index 0000000..fec2483
--- /dev/null
+++ b/xt/small-is-next-prev.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+$| = 1;  # fast pipes
+
+my $limit = shift || 20_000;
+
+use Math::Prime::Util qw/:all/;
+# Use another code base for comparison.
+use Math::Primality;
+
+foreach my $n (0 .. $limit) {
+  die "next $n" unless next_prime($n) == Math::Primality::next_prime($n);
+  if ($n <= 2) {
+    die "prev $n" unless prev_prime($n) == 0;
+  } else {
+    die "prev $n" unless prev_prime($n) == Math::Primality::prev_prime($n);
+  }
+  die "is $n" unless is_prime($n) == Math::Primality::is_prime($n);
+  print "$n.." unless $n % 10000;
+}
+print "Success to $limit!\n";

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