Branch Coverage

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


line true false branch
66 916 453 unless @_
67 32 421 scalar @_ > 1 ? :
472 2481 108 scalar @_ ? :
476 2481 108 if (defined $class) { }
519 1377 292 ref $arg ? :
745 6 2 unless (&Scalar::Util::looks_like_number($op2) or &Scalar::Util::blessed($op2) and $op2->isa('PDL'))
821 0 993 if $_[0]->isnull
822 1 992 unless $_[0]->nelem == 1
828 0 2013 if ($_[2]) { }
851 9 189 if ('PDL::Type' eq ref $t)
975 2 94 if $value eq '' or $value eq '[]'
983 10 84 if $value =~ /e\p{IsAlpha}/ or $value =~ /\p{IsAlpha}e/
995 4 80 if $value =~ /bad\B/ or $value =~ /\Bbad/
1000 0 80 if $value =~ /\Bnan/ or $value =~ /nan\B/
1002 3 77 if $value =~ s/\bnan\b/ee/gi
1004 0 80 if $value =~ /IND\B/i
1006 0 80 if $value =~ s/1\.\#IND/ee/gi
1010 2 78 if $value =~ /INF\B/i
1012 1 77 if $value =~ s/1\.\#INF/Ee/gi
1014 2 76 if $value =~ /inf\B/ or $value =~ /\Binf/
1016 3 73 if $value =~ s/\binf\b/Ee/gi
1018 4 72 if $value =~ /pi\B/ or $value =~ /\Bpi/
1024 0 72 if ($has_nan and not $types[$type]->usenan)
1030 0 72 if $has_inf and not $types[$type]->usenan
1036 4 68 if (my($disallowed) = $value =~ /([^\[\]\+\-0-9;,.eE ]+)/)
1051 7 61 if ($value =~ /;/)
1078 0 68 if $value =~ /EE[+\-]/ or $value =~ /[+\-]EE/
1082 2 66 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 66 if $PDL::Config{'BADVAL_USENAN'}
1134 60 6 if (ref $val eq 'ARRAY') { }
1136 31 29 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 130 unless s/^\[//
1184 64 341 if (/^\[/) { }
8 333 elsif (s/^\+//) { }
32 301 elsif (s/^\-//) { }
16 285 elsif (s/^bad//i) { }
5 280 elsif (s/^inf//i or s/1\.\#INF//i) { }
3 277 elsif (s/^nan//i or s/^1\.\#IND//i) { }
2 275 elsif (s/^pi//i) { }
11 264 elsif (s/^e//i) { }
264 0 elsif (s/^([\d+\-e.]+)//i) { }
1185 0 64 if $expects_number
1191 1 7 if $expects_number
1197 1 31 if $expects_number
1210 1 2 if ($sign == -1) { }
1227 233 27 $sign > 0 ? :
1246 0 1460 if ref $this
1247 151 1309 ref $_[0] eq 'PDL::Type' ? :
1248 500 960 @_ > 1 ? :
1250 58 1402 unless (defined $value)
1251 0 0 if ($PDL::debug and $PDL::undefval)
1257 772 688 if ref $value eq 'ARRAY'
1262 605 83 if (ref \$value eq 'SCALAR') { }
83 0 elsif (blessed($value)) { }
1271 96 509 if (is_scalar_SvPOK($value) and $value =~ /inf/i || $value =~ /nan/i || !&Scalar::Util::looks_like_number($value)) { }
0 509 elsif ($PDL::Core::Config{'ivsize'} < 8 and $PDL::Core::pack[$new->get_datatype] eq 'q*') { }
1322 0 836 unless blessed($value)
1324 836 0 unless defined $option
1325 0 836 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 213 unless defined $dim
1564 40 173 if $dim < 0
1565 169 44 defined $size ? :
1567 0 213 if $dim < 0
1572 4 209 $dim_diff > 0 ? :
1573 4 209 $dim_diff > 0 ? :
1634 2785 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 129 102 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 241 2522 $ref =~ /^(REF|SCALAR|ARRAY|HASH|CODE|GLOB||)$/ ? :
2212 2 1391 if $#_ > 1
2213 1277 114 if blessed($_[1])
2214 114 0 if ref \$_[1] eq 'SCALAR' or ref $_[1] eq 'ARRAY'
2222 453 0 if (ref $_[2] eq 'PDL::Type')
2223 326 127 if blessed($_[1])
2224 127 0 if $_[0] eq 'PDL'
2226 0 0 if blessed($_[1])
2333 145 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 225 572 ref $_[0] eq 'PDL::Type' ? :
2416 0 1479 if (ref $_) { }
2417 0 0 unless $_->isa('PDL')
2418 0 0 if $_->getndims > 1
2420 0 0 if $_->nelem > 10
2424 1457 22 if ($_) { }
2425 0 1457 if $_ < 0
2435 10 787 if $PDL::debug
2530 4 210 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2533 428 99 scalar @_ ? :
2571 5 78 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2574 79 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 378 if $#_ != 1
2736 0 378 unless ref $pdl
2737 337 41 if ref $type eq 'PDL::Type'
2738 0 378 unless &Scalar::Util::looks_like_number($type)
2739 157 221 if $pdl->get_datatype == $type
2858 0 361 if ($PDL::_STRINGIZING)
2863 0 359 if ($self->nelem > $PDL::toolongtoprint)
2866 210 149 if ($ndims == 0)
2867 6 204 if ($self->badflag and $self->isbad) { }
2871 0 204 $format ? :
2874 0 149 if $self->isnull
2875 6 143 if $self->isempty
2876 0 143 $PDL::use_commas ? :
2877 0 143 $PDL::use_commas ? :
2878 90 53 if ($ndims == 1) { }
2885 2 359 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
3087 0 4001 if $#_ < 0
3138 238 1 if (ref $this) { }
3139 0 238 if $chkmode == 1 and $this->nelem > 1
3141 2 236 if $chkmode == 2 and $this->nelem > 1
3146 0 1 if (lc $check eq 'warn') { }
1 0 elsif (lc $check eq 'barf') { }
3148 0 0 $check != 0 ? :
3214 1 63 if not defined $resdims[$j] or $resdims[$j] == 1
3215 2 62 if $d[$j] != 1 and $resdims[$j] != $d[$j]
3223 0 44 if ($_->badflag)
3225 18 5 if ($@ eq '')
3234 5 0 if ($@ =~ /PDL::Ops::assgn|mismatched/ or $@ =~ /"badflag"/ or $@ =~ /"initialize"/) { }
3242 3 2 if ($@ =~ /"initialize"/)
3244 0 3 unless @_
3255 5 0 if ref($_[$i]) =~ /PDL/
3261 4 12 if (not eval { do { $arg->isa('PDL') } }) { }
3 9 elsif (@dims != $arg->ndims) { }
3271 2 7 if ($dims[$j] != $arg->dim($j))
3282 2 3 if (@mismatched_dims > 1) { }
1 2 elsif (@mismatched_dims) { }
3294 2 3 if (@not_a_piddle > 1) { }
1 2 elsif (@not_a_piddle) { }
3305 0 5 if (@not_a_piddle == 0 and @mismatched_dims == 0)
3365 0 9 if ref $_[-1] eq 'HASH'
3370 0 25 if $opt->{'Break'}
3385 0 0 if (ref $x eq 'ARRAY') { }
0 0 elsif (ref $x eq 'PDL') { }
3387 0 0 if (defined $dims[$level]) { }
3388 0 0 unless $dims[$level] == scalar @$x
3394 0 0 if ($type) { }
3397 0 0 unless $type eq ref $_
3403 0 0 defined $_ ? :
3416 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)) { }
3447 56 2 if ($#dims == 1) { }
3460 0 2 if $PDL::use_commas
3471 0 90 if $self->getndims != 1
3476 1 89 if $dtype == $PDL::Core::PDL_F
3477 67 23 if $dtype == $PDL::Core::PDL_D
3478 2 88 if $dtype == $PDL::Core::PDL_IND
3482 71 390 if ($badflag and $t eq 'BAD') { }
0 390 elsif ($format) { }
3487 8 382 if ($dformat and length $t > 7)
3504 0 56 if scalar @dims != 2
3512 56 0 if (not defined $format or $format eq '')
3516 8 48 if ($badflag) { }
3518 27 43 if ($_ eq 'BAD') { }
3520 13 57 $i > $len ? :
3523 59 747 $i > $len ? :
3528 3 53 if ($len > 7) { }
3529 2 1 if ($dtype == $PDL::Core::PDL_F) { }
0 1 elsif ($dtype == $PDL::Core::PDL_D) { }
0 1 elsif ($dtype == $PDL::Core::PDL_IND) { }
3546 2 54 if ($findmax)
3550 0 2 if ($badflag) { }
3552 0 0 if ($_ eq 'BAD') { }
3554 0 0 $i > $len ? :
3558 2 38 $i > $len ? :
3569 27 849 if ($badflag and $x->[$i] eq 'BAD') { }
3575 6 870 if $t > 0
3577 674 202 if (($i + 1) % $dims[0]) { }
3582 56 146 if ($i == $#$x) { }
3963 0 0 if defined $pdl->gethdr or not defined $Astro::FITS::Header::VERSION
3980 0 122 if ($@)
3981 0 0 if $PDL::verbose
4009 5 0 $writable && $shared ? :
2 3 $creat ? :
0 5 unless sysopen my $fh, $name, ($writable && $shared ? 2 : 0) | ($creat ? 64 : 0), $mode
4014 2 3 if ($trunc)
4015 0 2 unless truncate $fh, 0
4016 0 2 unless truncate $fh, $len
4019 5 0 if ($len) { }
4023 0 5 if ($PDL::debug)
4024 0 0 $writable ? :
0 0 $shared ? :
4035 5 0 $writable ? :
5 0 $shared ? :
4050 0 5 if ($PDL::debug)