Branch Coverage

blib/lib/Math/Prime/Util.pm
Criterion Covered Total %
branch 142 260 54.6


line true false branch
142 0 132 if ($] < "5.02")
150 0 264 if @options != @_
153 0 129 if $_Config{'xs'} and $_Config{'secure'}
176 1 120 if defined $ENV{'MPU_NO_XS'} and $ENV{'MPU_NO_XS'} == 1
183 1 120 unless (eval { do { return 0 if defined $ENV{'MPU_NO_XS'} and $ENV{'MPU_NO_XS'} == 1; require XSLoader; XSLoader::load(__PACKAGE__, $Math::Prime::Util::VERSION); &prime_precalc(0); $_Config{'maxbits'} = &_XS_prime_maxbits(); $_Config{'xs'} = 1; 1 } })
185 0 1 unless defined $ENV{'MPU_NO_XS'} and $ENV{'MPU_NO_XS'} == 1
201 120 1 if (not defined $ENV{'MPU_NO_GMP'} or $ENV{'MPU_NO_GMP'} != 1)
202 0 120 if (eval { do { require Math::Prime::Util::GMP; "Math::Prime::Util::GMP"->import; 1 } })
211 0 0 if ($_Config{'gmp'} >= 42 and not Math::Prime::Util::GMP::is_csprng_well_seeded() and &_is_csprng_well_seeded())
219 0 121 if (defined $ENV{'MPU_DEVNAMES'} and $ENV{'MPU_DEVNAMES'} == 1)
222 0 0 if eval { do { require Math::Prime::Util::PP; "Math::Prime::Util::PP"->import; 1 } }
223 0 0 if $_Config{'gmp'}
255 2232 80 $_Config{'xs'} ? :
270 0 19 if ($param eq 'xs') { }
0 19 elsif ($param eq 'gmp') { }
2 17 elsif ($param eq 'nobigint') { }
0 17 elsif ($param eq 'bigint' or $param eq 'trybigint') { }
0 17 elsif ($param eq 'secure') { }
0 17 elsif ($param eq 'irand') { }
0 17 elsif ($param eq 'use_primeinc') { }
9 8 elsif ($param =~ /^(assume[_ ]?)?[ge]?rh$/ or $param =~ /riemann\s*h/) { }
8 0 elsif ($param eq 'verbose') { }
271 0 0 $value ? :
272 0 0 $_Config{'xs'} ? :
274 0 0 $value ? :
278 0 0 if $_Config{'xs'}
280 1 1 $value ? :
283 0 0 if (defined $class) { }
286 0 0 unless $param =~ /try/
290 0 0 if not $value and $_Config{'secure'}
291 0 0 if ($value)
293 0 0 if $_Config{'xs'}
300 5 4 $value ? :
302 8 0 if ($value =~ /^\d+$/) { }
0 0 elsif ($value =~ /^[ty]/i) { }
0 0 elsif ($value =~ /^[fn]/i) { }
307 8 0 if $_Config{'xs'}
308 0 8 if $_Config{'gmp'}
322 0 0 if (ref $val) { }
328 0 0 if ($INC{$cfname} or eval { do { require $cfname; $name->import; 1 } })
334 0 0 if ($class)
335 0 0 unless eval { do { $class->new(1) == 1 } }
342 0 70 if defined $_BIGINT
348 3 67 unless (defined $Math::BigInt::VERSION)
357 0 60295 unless defined $_[0]
358 60 60235 unless defined $_BIGINT
361 2805 57490 if (ref $_[0] eq $_BIGINT) { }
0 57490 elsif (ref $_[0] eq 'Math::BigFloat' and not $_[0]->is_int) { }
0 57490 elsif ($_BIGINT eq 'Math::Pari' and $_[0] =~ /^0[bx]/) { }
367 0 0 unless (defined $Math::BigInt::VERSION)
373 0 60295 unless $_BIGINT ne "Math::BigInt" or $n->is_int
377 0 49 unless defined $_[0]
378 9 40 unless defined $_BIGINT
380 0 49 if (ref $_[0] eq $_BIGINT) { }
1 48 elsif (ref $_[0] eq 'Math::BigFloat' and not $_[0]->is_int) { }
387 1 48 unless $_BIGINT ne 'Math::BigInt' || $n->is_int and $n >= 0
391 0 1650 unless defined $_[0]
393 18 1632 $n < 0 ? :
396 0 27 if not defined $_[0] or ref $_[0]
397 27 0 if ($_[0] >= '18446744073709551615' or $_[0] <= '-9223372036854775808')
399 27 0 if $n > '18446744073709551615' or $n < '-9223372036854775808'
404 0 0 unless (defined $Math::GMPz::VERSION)
405 0 0 ref $_[0] eq 'Math::GMPz' ? :
408 0 0 unless (defined $Math::GMP::VERSION)
409 0 0 ref $_[0] eq 'Math::GMP' ? :
412 0 270 unless defined $_[1]
414 245 25 if (do { $_[1] >= 0 }) { }
418 215 30 if $_[1] < '18446744073709551615'
420 0 25 if $_[1] > '-9223372036854775807'
423 5 50 if ($ref0) { }
426 1 49 unless defined $_BIGINT
429 48 7 if $bign > '18446744073709551615' or $bign < '-9223372036854775808'
434 0 1 unless defined $_BIGINT
436 2 0 if not defined $_[$i] or ref $_[$i]
437 0 0 if $_[$i] < '18446744073709551615' and $_[$i] > '-9223372036854775808'
439 0 0 if $n > '18446744073709551615' or $n < '-9223372036854775808'
450 0 0 unless $_Config{'gmp'} >= 42
451 0 0 unless defined $seedval
458 0 0 unless $_Config{'gmp'} >= 42
459 0 0 unless defined $str
473 0 1 unless $bits >= 2
475 0 1 if ($Math::Prime::Util::_GMPfunc{'random_maurer_prime_with_cert'})
487 0 1 unless $bits >= 2
489 0 1 if ($Math::Prime::Util::_GMPfunc{'random_shawe_taylor_prime_with_cert'})
501 0 1 unless $bits >= 2
504 0 1 if ($Math::Prime::Util::_GMPfunc{'random_maurer_prime_with_cert'})
517 0 5 unless ref $iref eq "ARRAY"
535 2 24 unless defined $start
537 21 2 $start > 0 ? :
541 22 1 if (not ref $p and $p <= $_XS_MAXVAL) { }
0 1 elsif ($_HAVE_GMP) { }
546 22 66 if (scalar @$pr == 0)
548 0 22 if $p >= '18446744073709551557'
550 18 4 $p <= 10000.0 ? :
551 0 22 if $p + $segment > '18446744073709551615' and $p + 1 < '18446744073709551615'
590 0 53 if $n < 2
593 37 16 if ($n <= $_XS_MAXVAL)
595 1 36 unless $isp == 2
599 0 16 if ($_HAVE_GMP and defined &Math::Prime::Util::GMP::is_provable_prime_with_cert)
603 0 0 if (ref $cert ne "ARRAY")
615 0 16 if $isp == 0
616 12 4 if $isp == 2
635 0 4 unless $isp
649 0 18 if $n <= 0
651 0 18 if $n > 10000000
653 6 8 if not ref $n and $_Config{'xs'}
661 2 18 if $n <= 0
663 9 9 if not ref $n and $_Config{'xs'}
671 1 78 if $n == 0
672 1 77 if $n == $_Neg_Infinity
673 1 76 if $n == $_Infinity
675 19 57 if not ref $n and $_Config{'xs'}
683 3 125 if $n == 0
684 1 124 if $n == 1
685 1 123 if $n == $_Infinity
687 1 122 if $n <= 0
689 66 32 if (not ref $n and $_Config{'xs'})
690 1 65 if $n == 2
701 9 1 if not ref $x and $_Config{'xs'}
709 1 26 unless (defined $Math::BigFloat::VERSION)
711 0 27 if ($Math::Prime::Util::_GMPfunc{'bernreal'})
712 0 0 unless defined $precision
717 11 16 if $num == 0
724 0 23 unless (defined $Math::BigFloat::VERSION)
725 1 22 if $n <= 0
727 0 22 if ($Math::Prime::Util::_GMPfunc{'harmreal'})
728 0 0 unless defined $precision
733 0 22 if (defined $precision and $precision <= 13)
735 0 0 $n < 80 ? :
741 0 22 if ($Math::Prime::Util::_GMPfunc{'harmfrac'})