Branch Coverage

blib/lib/PDL/Core.pm
Criterion Covered Total %
branch 327 508 64.3


line true false branch
66 914 485 unless @_
67 30 455 scalar @_ > 1 ? :
472 2505 108 scalar @_ ? :
476 2505 108 if (defined $class) { }
519 1401 292 ref $arg ? :
745 6 3 unless (&Scalar::Util::looks_like_number($op2) or &Scalar::Util::blessed($op2) and $op2->isa('PDL'))
821 0 1001 if $_[0]->isnull
822 1 1000 unless $_[0]->nelem == 1
828 0 2022 if ($_[2]) { }
851 9 189 if ('PDL::Type' eq ref $t)
975 2 97 if $value eq '' or $value eq '[]'
983 10 87 if $value =~ /e\p{IsAlpha}/ or $value =~ /\p{IsAlpha}e/
995 4 83 if $value =~ /bad\B/ or $value =~ /\Bbad/
1000 0 83 if $value =~ /\Bnan/ or $value =~ /nan\B/
1002 3 80 if $value =~ s/\bnan\b/ee/gi
1004 0 83 if $value =~ /IND\B/i
1006 0 83 if $value =~ s/1\.\#IND/ee/gi
1010 2 81 if $value =~ /INF\B/i
1012 1 80 if $value =~ s/1\.\#INF/Ee/gi
1014 2 79 if $value =~ /inf\B/ or $value =~ /\Binf/
1016 3 76 if $value =~ s/\binf\b/Ee/gi
1018 4 75 if $value =~ /pi\B/ or $value =~ /\Bpi/
1024 0 75 if ($has_nan and not $types[$type]->usenan)
1030 0 75 if $has_inf and not $types[$type]->usenan
1036 4 71 if (my($disallowed) = $value =~ /([^\[\]\+\-0-9;,.eE ]+)/)
1051 7 64 if ($value =~ /;/)
1078 0 71 if $value =~ /EE[+\-]/ or $value =~ /[+\-]EE/
1082 2 69 if (my($disallowed) = $value =~ /((\D+|\A)[eE]\d+)/)
1112 4 0 if ($_[0] =~ /(Argument ".*" isn't numeric)/) { }
0 0 elsif ($old_warn_handler) { }
1132 0 69 if $PDL::Config{'BADVAL_USENAN'}
1134 63 6 if (ref $val eq 'ARRAY') { }
1136 31 32 if ($to_return->dim(-1) == 1)
1137 19 12 if ($to_return->dims > 1) { }
12 0 elsif ($to_return->dims == 1) { }
1151 6 0 if ($@) { }
1175 0 133 unless s/^\[//
1184 64 396 if (/^\[/) { }
8 388 elsif (s/^\+//) { }
42 346 elsif (s/^\-//) { }
16 330 elsif (s/^bad//i) { }
5 325 elsif (s/^inf//i or s/1\.\#INF//i) { }
3 322 elsif (s/^nan//i or s/^1\.\#IND//i) { }
2 320 elsif (s/^pi//i) { }
11 309 elsif (s/^e//i) { }
309 0 elsif (s/^([\d+\-e.]+)//i) { }
1185 0 64 if $expects_number
1191 1 7 if $expects_number
1197 1 41 if $expects_number
1210 1 2 if ($sign == -1) { }
1227 268 37 $sign > 0 ? :
1246 0 1515 if ref $this
1247 167 1348 ref $_[0] eq 'PDL::Type' ? :
1248 526 989 @_ > 1 ? :
1250 58 1457 unless (defined $value)
1251 0 0 if ($PDL::debug and $PDL::undefval)
1257 796 719 if ref $value eq 'ARRAY'
1262 634 85 if (ref \$value eq 'SCALAR') { }
85 0 elsif (blessed($value)) { }
1271 99 535 if (is_scalar_SvPOK($value) and $value =~ /inf/i || $value =~ /nan/i || !&Scalar::Util::looks_like_number($value)) { }
0 535 elsif ($PDL::Core::Config{'ivsize'} < 8 and $PDL::Core::pack[$new->get_datatype] eq 'q*') { }
1322 0 838 unless blessed($value)
1324 838 0 unless defined $option
1325 0 838 if ($value->is_inplace)
1368 0 71 if $PDL::debug
1370 0 71 unless (ref($hdr) =~ /HASH/)
1371 0 0 if $PDL::debug
1375 6 65 if ($tobj = tied %$hdr) { }
0 65 elsif (UNIVERSAL::can($hdr, 'copy')) { }
1376 0 6 if $PDL::debug
1377 0 6 if (UNIVERSAL::can($tobj, 'copy'))
1380 0 0 if $PDL::debug
1388 6 0 if (UNIVERSAL::isa($tobj, 'Astro::FITS::Header'))
1389 0 6 if $PDL::debug
1393 0 6 if $PDL::debug
1398 0 0 if $PDL::debug
1403 0 65 if $PDL::debug
1417 65 0 if (ref $val eq 'HASH')
1421 0 700 ref $value ? :
1426 0 0 if (ref $val eq 'ARRAY')
1429 0 0 ref $z ? :
1434 0 0 if (ref $val eq 'SCALAR')
1439 0 0 if (ref $val eq 'REF')
1445 0 0 if (UNIVERSAL::isa($val, 'PDL'))
1447 0 0 if $h = $val->hdrcpy
1449 0 0 if $h
1453 0 0 if (UNIVERSAL::can($val, 'copy'))
1563 0 215 unless defined $dim
1564 40 175 if $dim < 0
1565 169 46 defined $size ? :
1567 0 215 if $dim < 0
1572 4 211 $dim_diff > 0 ? :
1573 4 211 $dim_diff > 0 ? :
1634 2817 1 if ($#_ < 2) { }
1640 0 1 if @dims > $ndims
1642 0 2 if $dim > $ndims - 1
1644 1 1 if $targd > $dim
1645 0 2 if $dimmark[$dim]++ > $dim
1648 0 1 if $targd > 0
1732 2 2 if ($str =~ s/[,]*\s*NOtherPars\s*=>\s*([0-9]+)\s*[,]*//)
1733 0 4 unless $str =~ /\s*([^(]+)\((.+)\)\s*$/x
1735 4 0 if $PDL::debug
1739 0 4 if $args == 0
1747 4 0 if $PDL::debug
1749 0 4 if $@
1951 0 11 if ($nids > 0)
2065 3 9 unless defined $str
2066 1 11 if $this->isnull
2071 48 48 if ($form =~ s/^%([-,0-9]*[.]?[0-9]*)(\w)$/%$1s/)
2072 0 48 unless defined $info{$2}
2114 136 103 unless defined $eps
2140 0 1 $_[0] =~ /\(.*\)/ ? :
2147 0 13 $#$_ > 1 && @$_[2] == 0 ? :
1 0 !ref($_) ? :
13 1 ref $_ eq 'ARRAY' ? :
1 14 !ref($_) && $_ eq 'X' ? :
2177 0 0 if (ref $pdl eq 'CODE')
2197 0 0 unless ($PDL::nslice_warning_issued)
2206 257 2552 $ref =~ /^(REF|SCALAR|ARRAY|HASH|CODE|GLOB||)$/ ? :
2212 2 1401 if $#_ > 1
2213 1287 114 if blessed($_[1])
2214 114 0 if ref \$_[1] eq 'SCALAR' or ref $_[1] eq 'ARRAY'
2222 485 0 if (ref $_[2] eq 'PDL::Type')
2223 342 143 if blessed($_[1])
2224 143 0 if $_[0] eq 'PDL'
2226 0 0 if blessed($_[1])
2333 146 393 if ($pdl->is_inplace) { }
2337 1 392 if (defined $preferred) { }
2340 0 1 if ref $preferred eq 'ARRAY'
2342 0 1 if ($preferred =~ /(^|\,)$s(\,|$)/i) { }
2413 223 576 ref $_[0] eq 'PDL::Type' ? :
2416 0 1478 if (ref $_) { }
2417 0 0 unless $_->isa('PDL')
2418 0 0 if $_->getndims > 1
2420 0 0 if $_->nelem > 10
2424 1456 22 if ($_) { }
2425 0 1456 if $_ < 0
2435 10 789 if $PDL::debug
2530 4 212 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2533 430 99 scalar @_ ? :
2571 5 80 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2574 81 73 scalar @_ ? :
2646 8 73 if (@_ == 2 and $_[1] == -1)
2647 7 8 $_ == 1 ? :
2653 2 105 if $dim < 0
2654 1 70 if @dims == 0
2657 0 71 if ($pdl->nelem > $nelem)
2706 209 238 $_[0]->getndims != 1 ? :
2734 0 394 if $#_ != 1
2736 0 394 unless ref $pdl
2737 353 41 if ref $type eq 'PDL::Type'
2738 0 394 unless &Scalar::Util::looks_like_number($type)
2739 154 240 if $pdl->get_datatype == $type
2858 0 362 if ($PDL::_STRINGIZING)
2863 0 360 if ($self->nelem > $PDL::toolongtoprint)
2866 206 154 if ($ndims == 0)
2867 6 200 if ($self->badflag and $self->isbad) { }
2871 0 200 $format ? :
2874 0 154 if $self->isnull
2875 6 148 if $self->isempty
2876 0 148 $PDL::use_commas ? :
2877 0 148 $PDL::use_commas ? :
2878 95 53 if ($ndims == 1) { }
2885 2 360 if ($@)
2927 0 17 if $#_ != 0
2929 0 17 if nelem($pdl) == 0
2971 0 6 if $#_ != 0
2973 0 6 if $pdl->nelem == 0
2979 4 11 if ($pdl->ndims > 1) { }
3012 0 0 if $#_ != 0
3014 0 0 if nelem($pdl) == 0
3015 0 0 if scalar dims($pdl) != 1
3049 0 46 if $#_ < 2
3085 0 4030 if $#_ < 0
3136 241 1 if (ref $this) { }
3137 0 241 if $chkmode == 1 and $this->nelem > 1
3139 2 239 if $chkmode == 2 and $this->nelem > 1
3144 0 1 if (lc $check eq 'warn') { }
1 0 elsif (lc $check eq 'barf') { }
3146 0 0 $check != 0 ? :
3212 1 68 if not defined $resdims[$j] or $resdims[$j] == 1
3213 2 67 if $d[$j] != 1 and $resdims[$j] != $d[$j]
3221 0 49 if ($_->badflag)
3223 20 5 if ($@ eq '')
3232 5 0 if ($@ =~ /PDL::Ops::assgn|mismatched/ or $@ =~ /"badflag"/ or $@ =~ /"initialize"/) { }
3240 3 2 if ($@ =~ /"initialize"/)
3242 0 3 unless @_
3253 5 0 if ref($_[$i]) =~ /PDL/
3259 4 12 if (not eval { do { $arg->isa('PDL') } }) { }
3 9 elsif (@dims != $arg->ndims) { }
3269 2 7 if ($dims[$j] != $arg->dim($j))
3280 2 3 if (@mismatched_dims > 1) { }
1 2 elsif (@mismatched_dims) { }
3292 2 3 if (@not_a_piddle > 1) { }
1 2 elsif (@not_a_piddle) { }
3303 0 5 if (@not_a_piddle == 0 and @mismatched_dims == 0)
3363 0 9 if ref $_[-1] eq 'HASH'
3368 0 25 if $opt->{'Break'}
3383 0 0 if (ref $x eq 'ARRAY') { }
0 0 elsif (ref $x eq 'PDL') { }
3385 0 0 if (defined $dims[$level]) { }
3386 0 0 unless $dims[$level] == scalar @$x
3392 0 0 if ($type) { }
3395 0 0 unless $type eq ref $_
3401 0 0 defined $_ ? :
3414 0 0 if (ref \$x eq 'SCALAR') { }
0 0 elsif (ref $x eq 'SCALAR') { }
0 0 elsif (ref $x eq 'ARRAY') { }
0 0 elsif (ref $x eq 'HASH') { }
0 0 elsif (blessed($x)) { }
3445 56 2 if ($#dims == 1) { }
3458 0 2 if $PDL::use_commas
3469 0 95 if $self->getndims != 1
3474 1 94 if $dtype == $PDL::Core::PDL_F
3475 69 26 if $dtype == $PDL::Core::PDL_D
3476 2 93 if $dtype == $PDL::Core::PDL_IND
3480 71 405 if ($badflag and $t eq 'BAD') { }
0 405 elsif ($format) { }
3485 12 393 if ($dformat and length $t > 7)
3502 0 56 if scalar @dims != 2
3510 56 0 if (not defined $format or $format eq '')
3514 8 48 if ($badflag) { }
3516 27 43 if ($_ eq 'BAD') { }
3518 13 57 $i > $len ? :
3521 59 747 $i > $len ? :
3526 3 53 if ($len > 7) { }
3527 1 2 if ($dtype == $PDL::Core::PDL_F) { }
0 2 elsif ($dtype == $PDL::Core::PDL_D) { }
0 2 elsif ($dtype == $PDL::Core::PDL_IND) { }
3544 1 55 if ($findmax)
3548 0 1 if ($badflag) { }
3550 0 0 if ($_ eq 'BAD') { }
3552 0 0 $i > $len ? :
3556 1 19 $i > $len ? :
3567 27 849 if ($badflag and $x->[$i] eq 'BAD') { }
3573 6 870 if $t > 0
3575 674 202 if (($i + 1) % $dims[0]) { }
3580 56 146 if ($i == $#$x) { }
3961 0 0 if defined $pdl->gethdr or not defined $Astro::FITS::Header::VERSION
3978 0 123 if ($@)
3979 0 0 if $PDL::verbose
4007 5 0 $writable && $shared ? :
2 3 $creat ? :
0 5 unless sysopen my $fh, $name, ($writable && $shared ? 2 : 0) | ($creat ? 64 : 0), $mode
4012 2 3 if ($trunc)
4013 0 2 unless truncate $fh, 0
4014 0 2 unless truncate $fh, $len
4017 5 0 if ($len) { }
4021 0 5 if ($PDL::debug)
4022 0 0 $writable ? :
0 0 $shared ? :
4033 5 0 $writable ? :
5 0 $shared ? :
4048 0 5 if ($PDL::debug)