This is an automated email from the git hooks/post-receive script. ppm-guest pushed a commit to annotated tag v0.22 in repository libmath-prime-util-perl.
commit 0fada752338c36a13d9409520a1d1b68b200c103 Author: Dana Jacobsen <d...@acm.org> Date: Tue Feb 26 01:05:43 2013 -0800 Turn thread tests on for Cygwin and NetBSD. Add simple RiemannZeta test cases --- t/18-functions.t | 19 +++++++++++++++++-- t/31-threading.t | 18 ++---------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/t/18-functions.t b/t/18-functions.t index 5cbb4f2..4cef078 100644 --- a/t/18-functions.t +++ b/t/18-functions.t @@ -3,13 +3,15 @@ use strict; use warnings; use Test::More; -use Math::Prime::Util qw/prime_count ExponentialIntegral LogarithmicIntegral RiemannR/; +use Math::Prime::Util qw/ + prime_count ExponentialIntegral LogarithmicIntegral RiemannR RiemannZeta +/; my $use64 = Math::Prime::Util::prime_get_config->{'maxbits'} > 32; my $extra = defined $ENV{RELEASE_TESTING} && $ENV{RELEASE_TESTING}; my $infinity = 20**20**20; -plan tests => 3 + 6 + 1 + 16 + 11 + 9; +plan tests => 3 + 6 + 1 + 16 + 11 + 9 + 6; eval { LogarithmicIntegral(-1); }; like($@, qr/invalid/i, "li(-1) is invalid"); @@ -87,6 +89,19 @@ while (my($n, $rin) = each (%rvals)) { cmp_closeto( RiemannR($n), $rin, 0.00000001 * abs($rin), "R($n) ~= $rin"); } +my %rzvals = ( + 2 => 0.6449340668482264364724151666, + 2.5 => 0.3414872572509171797567696934, + 4.5 => 0.0547075107614542640229672890, + 7 => 0.0083492773819228268397975498, + 8.5 => 0.0028592508824156277133439825, + 20.6 => 0.0000006293391573578212882457, +); +while (my($n, $zin) = each (%rzvals)) { + cmp_closeto( RiemannZeta($n), $zin, 0.00000001 * abs($zin), "Zeta($n) ~= $zin"); +} + + sub cmp_closeto { my $got = shift; diff --git a/t/31-threading.t b/t/31-threading.t index cf182df..06b6356 100644 --- a/t/31-threading.t +++ b/t/31-threading.t @@ -8,16 +8,6 @@ BEGIN { print("1..0 # Skip Threads not supported\n"); exit(0); } - # All these tests used to run on Cygwin, but now they're all giving me - # random panics in mutexes. Same with NetBSD. - if ($Config{osname} eq 'cygwin') { - print "1..0 # Skip Cygwin threads are unstable\n"; - exit 0; - } - if ($Config{osname} eq 'netbsd') { - print "1..0 # Skip NetBSD threads have panic issues\n"; - exit 0; - } # Should be be looking for newer than 5.008? if (! eval { require threads }) { print "1..0 # Skip threads.pm not installed\n"; @@ -102,11 +92,7 @@ thread_test( sub { my $sum = 0; $sum += is_prime($_) for (@randn); return $sum;}, $numthreads, "is_prime"); -# Override rand because some systems don't use thread-safe rand, which will -# make this test go beserk (it doesn't make *sense* without TS rand). -# This should provide a semi-random result that depends on the seed given. -# rand should return a number in the range [0,1) --- 0 is ok, 1 is not. Since -# this is all in Perl, it all gets duped with the interpreter so is TS. +# Custom rand, so we get the same result each time. { my $seed = 1; sub mysrand { $seed = $_[0]; } @@ -116,7 +102,7 @@ thread_test( thread_test( sub { my $sum = 0; for (@randn) { mysrand($_); $sum += random_ndigit_prime(6); } return $sum;}, - $numthreads, "random 7-digit prime"); + $numthreads, "random 6-digit prime"); thread_test( sub { my $sum = 0; $sum += int(RiemannR($_)) for (@randn); return $sum;}, -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits