This is an automated email from the git hooks/post-receive script. ppm-guest pushed a commit to annotated tag v0.17 in repository libmath-prime-util-perl.
commit 5711de769abb7c1cfe27aac69723a332cb9974f0 Author: Dana Jacobsen <d...@acm.org> Date: Mon Dec 17 02:29:56 2012 -0800 Allow turning off MPFR. Run travis tests on dynamic dependency variations. --- .travis.yml | 11 ++++++++++- lib/Math/Prime/Util.pm | 2 +- lib/Math/Prime/Util/PP.pm | 20 ++++++++++++-------- t/02-can.t | 13 +++++++++---- t/03-init.t | 10 ++++++++++ t/81-bignum.t | 8 +++++--- 6 files changed, 47 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index a2a0894..3914caf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,16 @@ perl: - "5.12" - "5.10" -#before_script: +before_script: + - cpanm Math::Prime::Util::GMP + - cpanm Math::MPFR + +env: + - MPU_NO_XS=1 MPU_NO_GMP=1 MPU_NO_MPFR=1 + - MPU_NO_MPFR=1 + - MPU_NO_GMP=1 + - MPU_NO_GMP=1 MPU_NO_MPFR=1 + # - sudo apt-get install libgmp3-dev # - cpanm Test::Pod # optional dependency diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm index 4f9000c..6ed33e2 100644 --- a/lib/Math/Prime/Util.pm +++ b/lib/Math/Prime/Util.pm @@ -69,7 +69,7 @@ BEGIN { $_Config{'maxbits'} = _XS_prime_maxbits(); 1; } or do { - carp "Using Pure Perl implementation: $@"; + #carp "Using Pure Perl implementation: $@"; $_Config{'xs'} = 0; $_Config{'maxbits'} = Math::Prime::Util::PP::_PP_prime_maxbits(); diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm index 9303064..57b2050 100644 --- a/lib/Math/Prime/Util/PP.pm +++ b/lib/Math/Prime/Util/PP.pm @@ -1436,8 +1436,9 @@ sub ExponentialIntegral { # Use MPFR if possible. if ($_have_MPFR < 0) { - $_have_MPFR = 1; - eval { require Math::MPFR; $Math::MPFR::VERSION >= 2.03; } or do { $_have_MPFR = 0; }; + $_have_MPFR = 0; + $_have_MPFR = 1 if (!defined $ENV{MPU_NO_MPFR} || $ENV{MPU_NO_MPFR} != 1) + && eval { require Math::MPFR; $Math::MPFR::VERSION>=2.03; }; } # Gotcha -- MPFR decided to make negative inputs return NaN. Grrr. if ($_have_MPFR && $x > 0) { @@ -1545,8 +1546,9 @@ sub LogarithmicIntegral { # Use MPFR if possible. if ($_have_MPFR < 0) { - $_have_MPFR = 1; - eval { require Math::MPFR; $Math::MPFR::VERSION >= 2.03; } or do { $_have_MPFR = 0; }; + $_have_MPFR = 0; + $_have_MPFR = 1 if (!defined $ENV{MPU_NO_MPFR} || $ENV{MPU_NO_MPFR} != 1) + && eval { require Math::MPFR; $Math::MPFR::VERSION>=2.03; }; } # Remember MPFR eint doesn't handle negative inputs if ($_have_MPFR && $x >= 1) { @@ -1677,8 +1679,9 @@ sub RiemannZeta { # Use MPFR if possible. if ($_have_MPFR < 0) { - $_have_MPFR = 1; - eval { require Math::MPFR; $Math::MPFR::VERSION >= 2.03; } or do { $_have_MPFR = 0; }; + $_have_MPFR = 0; + $_have_MPFR = 1 if (!defined $ENV{MPU_NO_MPFR} || $ENV{MPU_NO_MPFR} != 1) + && eval { require Math::MPFR; $Math::MPFR::VERSION>=2.03; }; } if ($_have_MPFR) { my $wantbf = 0; @@ -1742,8 +1745,9 @@ sub RiemannR { # Use MPFR if possible. if ($_have_MPFR < 0) { - $_have_MPFR = 1; - eval { require Math::MPFR; $Math::MPFR::VERSION >= 2.03; } or do { $_have_MPFR = 0; }; + $_have_MPFR = 0; + $_have_MPFR = 1 if (!defined $ENV{MPU_NO_MPFR} || $ENV{MPU_NO_MPFR} != 1) + && eval { require Math::MPFR; $Math::MPFR::VERSION>=2.03; }; } if ($_have_MPFR) { my $wantbf = 0; diff --git a/t/02-can.t b/t/02-can.t index 35a97b7..89498c0 100644 --- a/t/02-can.t +++ b/t/02-can.t @@ -6,16 +6,21 @@ use Math::Prime::Util; use Test::More tests => 1; my @functions = qw( - prime_get_config + prime_get_config prime_set_config prime_precalc prime_memfree - is_prime is_prob_prime + is_prime is_prob_prime is_provable_prime is_strong_pseudoprime is_strong_lucas_pseudoprime + is_aks_prime + miller_rabin primes next_prime prev_prime prime_count prime_count_lower prime_count_upper prime_count_approx nth_prime nth_prime_lower nth_prime_upper nth_prime_approx random_prime random_ndigit_prime random_nbit_prime random_maurer_prime - factor all_factors moebius euler_phi - ExponentialIntegral LogarithmicIntegral RiemannR + primorial pn_primorial + factor all_factors + moebius euler_phi jordan_totient + divisor_sum + ExponentialIntegral LogarithmicIntegral RiemannZeta RiemannR ); can_ok( 'Math::Prime::Util', @functions); diff --git a/t/03-init.t b/t/03-init.t index 3dbf12e..d211359 100644 --- a/t/03-init.t +++ b/t/03-init.t @@ -13,6 +13,16 @@ my $bigsize = 10_000_000; can_ok( 'Math::Prime::Util', 'prime_get_config' ); +my $diag = "Using " . + ((Math::Prime::Util::prime_get_config->{xs}) + ? "XS" + : "PP") . + ((Math::Prime::Util::prime_get_config->{gmp}) + ? " with MPU::GMP version $Math::Prime::Util::GMP::VERSION." + : ".") . + "\n"; +diag $diag; + my $init_size = prime_get_config->{'precalc_to'}; prime_precalc($bigsize); diff --git a/t/81-bignum.t b/t/81-bignum.t index 719ab90..51d024f 100644 --- a/t/81-bignum.t +++ b/t/81-bignum.t @@ -109,9 +109,11 @@ use Math::Prime::Util qw/ # LogarithmicIntegral # RiemannR -# See if we're testing bignum with PP or GMP. -diag "Math::Prime::Util::GMP not being used.\n" - unless Math::Prime::Util::prime_get_config->{gmp}; +my $bigintlib = Math::BigInt->config()->{lib}; +$bigintlib =~ s/^Math::BigInt:://; +my $mpugmpver = Math::Prime::Util::prime_get_config->{gmp} + ? $Math::Prime::Util::GMP::VERSION : "<none>"; +diag "BigInt library: $bigintlib, MPU::GMP $mpugmpver\n"; ############################################################################### -- 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