Branch Coverage

blib/lib/PDL/Core.pm
Criterion Covered Total %
branch 365 508 71.8


line true false branch
68 11013 1080 unless @_
69 173 907 @_ > 1 ? :
483 2179 171 scalar @_ ? :
487 2179 171 if (defined $class) { }
530 228 1077 ref $arg ? :
701 2 2 $pdl->type->real ? :
839 46 7857 if $_[0]->isnull
840 4 7853 unless $_[0]->nelem == 1
842 1 7852 if $_[0]->badflag and $_[0] . '' eq "BAD"
857 7689 492 if ("PDL::Type" eq ref $t)
1002 2 489 if $value eq "" or $value eq "[]"
1006 10 479 if $value =~ /e\p{IsAlpha}|\p{IsAlpha}e/
1019 4 475 if $value =~ /bad\B|\Bbad/
1024 0 475 if $value =~ /\Bnan|nan\B/
1026 12 463 if $value =~ s/\bnan\b/ee/gi
1028 0 475 if $value =~ /IND\B/i
1030 0 475 if $value =~ s/1\.\#IND/ee/gi
1034 2 473 if $value =~ /INF\B/i
1036 1 472 if $value =~ s/1\.\#INF/Ee/gi
1038 2 471 if $value =~ /inf\B|\Binf/
1040 7 464 if $value =~ s/\binf\b/Ee/gi
1042 4 467 if $value =~ /pi\B|\Bpi/
1047 0 467 if $value =~ /(i\B|[^\-+\d\s.\[]i)/
1049 70 397 if $value =~ s/([\-+\d]*)i\b/$1EeE/gi
1050 70 397 if $has_i
1054 0 467 if ($has_nan and not $types[$type]->usenan)
1060 0 467 if $has_inf and not $types[$type]->usenan
1066 4 463 if (my($disallowed) = $value =~ /([^\[\]\+\-0-9;,.eE ]+)/)
1081 143 320 if ($value =~ /;/)
1104 0 463 if $value =~ /EE[+\-]|[+\-]EE/
1108 2 461 if (my($disallowed) = $value =~ /((\D+|\A)[eE]\d+)/)
1115 106 355 $has_bad ? :
1118 95 47 length $2 ? :
70 391 if $has_i
1127 0 0 if ($_[0] =~ /(Argument ".*" isn't numeric)/) { }
0 0 elsif ($old_warn_handler) { }
1145 4 457 if (ref $val ne "ARRAY")
1152 193 264 if ($to_return->dim(-1) == 1)
1153 152 41 if ($to_return->dims > 1) { }
41 0 elsif ($to_return->dims == 1) { }
1178 0 1209 unless s/^\[//
1186 748 3727 if (/^\[/) { }
12 3715 elsif (s/^\+//) { }
326 3389 elsif (s/^\-//) { }
169 3220 elsif (s/^bad//i) { }
9 3211 elsif (s/^inf//i or s/1\.\#INF//i) { }
21 3190 elsif (s/^nan//i or s/^1\.\#IND//i) { }
3 3187 elsif (s/^pi//i) { }
13 3174 elsif (s/^e//i) { }
83 3091 elsif ($has_i and s/^${NUM_RE}i//i) { }
59 3032 elsif ($has_i and s/^$NUM_RE([-+])${NUM_RE}i//i) { }
3030 2 elsif (s/^$NUM_RE([^e])/$2/i) { }
1187 0 748 if $expects_number
1193 1 11 if $expects_number
1199 1 325 if $expects_number
1226 17 42 $2 eq '-' ? :
1250 0 4179 if $sofar > $MAX_TYPE
1251 0 4179 if $sofar == $MAX_TYPE
1252 7 4172 if UNIVERSAL::isa($item, "Math::Complex")
1253 270 3902 if UNIVERSAL::isa($item, "PDL")
1254 1757 2145 if ref $item ne "ARRAY"
1256 0 2145 if _establish_type($item->[0], $sofar) == $MAX_TYPE
1263 3 15584 if ref $_[0] and UNIVERSAL::isa($_[0], "PDL")
1265 7701 7883 ref $_[0] eq 'PDL::Type' ? :
1266 6423 9161 @_ > 1 ? :
1267 116 15468 unless (defined $value)
1268 0 116 if ($PDL::debug)
1273 1145 6738 ref $value ? :
1275 7184 8400 if ref $value eq "ARRAY"
1279 8255 145 if (ref \$value eq 'SCALAR') { }
1 144 elsif (builtin::blessed($value) and UNIVERSAL::isa($value, 'Math::Complex')) { }
144 0 elsif (builtin::blessed($value)) { }
1288 491 7764 if (is_scalar_SvPOK($value) and $value =~ /inf/i || $value =~ /nan/i || !&Scalar::Util::looks_like_number($value)) { }
0 7764 elsif (not $CAN_PACK_QUAD and $PDL::Core::pack[$new->get_datatype] =~ /^q\*$/i) { }
0 7764 elsif (not $CAN_PACK_D and $PDL::Core::pack[$new->get_datatype] =~ /^(D\*|\(DD\)\*)$/) { }
1307 7376 388 if ($value) { }
1346 0 884 unless builtin::blessed($value)
1347 1 883 if $value->isnull
1386 0 4803 if $PDL::debug
1388 0 4803 unless (ref($hdr) =~ /HASH/)
1389 0 0 if $PDL::debug
1393 4657 146 if ($tobj = tied %$hdr) { }
0 146 elsif (UNIVERSAL::can($hdr, 'copy')) { }
1394 0 4657 if $PDL::debug
1395 0 4657 if (UNIVERSAL::can($tobj, "copy"))
1398 0 0 if $PDL::debug
1406 4657 0 if (UNIVERSAL::isa($tobj, "Astro::FITS::Header"))
1407 0 4657 if $PDL::debug
1411 0 4657 if $PDL::debug
1416 0 0 if $PDL::debug
1421 0 146 if $PDL::debug
1435 146 0 if (ref $val eq "HASH")
1437 0 1867 ref $_ ? :
1441 0 0 ref $_ ? :
0 0 if ref $val eq "ARRAY"
1443 0 0 if (ref $val eq "SCALAR")
1448 0 0 if (ref $val eq "REF")
1454 0 0 if (UNIVERSAL::isa($val, "PDL"))
1456 0 0 if $h = $val->hdrcpy
1458 0 0 if $h
1462 0 0 if (UNIVERSAL::can($val, "copy"))
1707 0 422 unless defined $dim
1708 47 375 if $dim < 0
1709 208 214 defined $size ? :
1710 0 422 if $dim < 0
1714 3 419 $dim_diff > 0 ? :
1715 3 419 $dim_diff > 0 ? :
1736 0 1 if $times == 1
1763 0 1 unless grep(($_ != 1), @times)
1793 0 1 unless grep(($_ != 1), @times)
1844 11889 23 if @_ < 3
1849 0 23 if @dims > $ndims
1851 0 46 if $dim > $ndims - 1
1853 23 23 if $targd > $dim
1854 0 46 if $dimmark[$dim]++ > $dim
1857 17 6 if $targd > 0
1940 4 2 if ($str =~ s/[,]*\s*NOtherPars\s*=>\s*([0-9]+)\s*[,]*//)
1941 0 6 unless $str =~ /\s*([^(]+)\((.+)\)\s*$/x
1943 0 6 if $PDL::debug
1947 0 6 if $args == 0
1951 0 6 if $PDL::debug
2106 6 36 if ($nids > 0)
2222 13 76 unless defined $str
2223 1 88 if $this->isnull
2228 172 203 if ($form =~ s/^%([-,0-9]*[.]?[0-9]*)(\w)$/%$1s/)
2229 0 172 unless defined $info{$2}
2257 1 1 !$svaddr ? :
2264 0 2 if $pdl->has_vafftrans
2265 0 0 $pdl->has_badvalue ? :
2 0 !$pdl->badflag ? :
2268 1 1 !$pdl->allocated ? :
2271 1 1 if (my $trans = $pdl->trans_parent)
2274 0 2 if (my(@trans_children) = $pdl->trans_children)
2306 2 0 $outs[0]->dimschgd ? :
2 0 if $trans->affine
2341 0 12 unless ref $obj
2344 0 12 if $sofar->{$addr}
2345 4 8 if ($obj->isa('PDL::Trans')) { }
2349 4 0 !($obj->affine && !$outs[0]->dimschgd) ? :
2361 6 3 unless $$sofar{sprintf "0x%x", $r->address}
2365 8 0 !$obj->has_vafftrans ? :
4 4 !$obj->allocated ? :
2381 3 6 unless $$sofar{sprintf "0x%x", $r->address}
2407 0 0 if ($props->{'kind'} eq "trans")
2412 0 0 if (my $from = $props->{'vaffine_from'})
2456 0 0 if (my $from = $attrs->{'vaffine_from'})
2463 0 0 if ($kind eq 'trans') { }
2472 0 0 @vflags ? :
2474 0 0 if $affine
2482 0 0 $firstvals ? :
2485 0 0 $kind eq 'ndarray' ? :
2532 14 1 unless defined $eps
2571 0 1 if (ref $pdl eq "CODE")
2583 1080 60 if (ref $_[2] eq "PDL::Type")
2584 363 717 if builtin::blessed($_[1])
2585 717 0 if $_[0] eq "PDL"
2587 0 60 if builtin::blessed($_[1])
2713 29 350 if (builtin::blessed($pdl) and $pdl->is_inplace)
2718 278 71 builtin::blessed($pdl) ? :
349 1 unless defined $preferred
2719 1 0 if ref $preferred ne "ARRAY"
2721 0 1 if grep(($_ eq $s), @$preferred)
2870 10 478 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2907 0 901 unless @_
2908 396 505 unless UNIVERSAL::can($_[0], "new_from_specification")
2909 587 314 @_ > 1 ? :
2911 59 146 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2939 1 11 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2967 1 16 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
2996 1 55 ref $_[0] && ref $_[0] ne 'PDL::Type' ? :
3000 7 53 if (@args) { }
3001 3 4 if (ref $args[0] eq 'PDL::Type' and $args[0]->real) { }
3007 2 51 if ref $class and $class->type->real
3009 7 53 scalar @args ? :
3082 17 138 if (@_ == 2 and $_[1] == -1)
3083 15 11 $_ == 1 ? :
3088 2 196 if $dim < 0
3089 2 134 if @dims == 0
3092 1 135 if ($pdl->nelem > $nelem)
3141 11624 2942 $_[0]->getndims != 1 ? :
3173 0 601 if @_ != 2
3176 1 600 if $pdl->isnull
3177 477 123 if ref $type eq "PDL::Type"
3178 0 600 unless &Scalar::Util::looks_like_number($type)
3179 256 344 if $pdl->get_datatype == $type
3180 337 7 unless $pdl->is_inplace
3205 0 1 if @_ != 2
3207 0 1 unless UNIVERSAL::isa($pdl, "PDL")
3208 0 1 if $pdl->isnull
3209 0 1 if $pdl->is_inplace
3210 1 0 if ref $type eq "PDL::Type"
3211 0 1 unless &Scalar::Util::looks_like_number($type)
3212 0 1 if $pdl->get_datatype == $type
3360 2043 1451 if $PDL::_STRINGIZING
3362 8 1443 if $self->isnull
3363 7 1436 if $self->isempty
3364 7 1429 if $self->nelem > $PDL::toolongtoprint
3366 1027 402 if ($ndims == 0)
3367 13 1014 if $self->badflag and $self->isbad
3369 0 1014 $format ? :
3371 0 402 $PDL::use_commas ? :
3372 0 402 $PDL::use_commas ? :
3373 297 105 if $ndims == 1
3376 0 3494 if ($@)
3415 0 30 if $#_ != 0
3417 0 30 if nelem($pdl) == 0
3488 0 0 if $#_ != 0
3490 0 0 if nelem($pdl) == 0
3491 0 0 if scalar dims($pdl) != 1
3525 0 58 if $#_ < 2
3560 0 19879 if $#_ < 0
3643 1 58 if not defined $resdims[$j] or $resdims[$j] == 1
3644 3 56 if $d[$j] != 1 and $resdims[$j] != $d[$j]
3651 0 41 unless @_
3653 97 7 UNIVERSAL::isa($_[$_], 'PDL') ? :
3654 0 41 unless @yes_ndarray
3658 36 5 if (not $@ and $yes_ndarray[0] == 0)
3669 2 77 if ($_->badflag)
3671 36 0 unless $@
3678 3 2 if ($@ and $@ =~ /mismatched/)
3684 3 7 if (@dims != $arg->ndims) { }
3688 5 2 if $dims[$j] == $arg->dim($j)
3697 0 5 if $@ and not $@ =~ /PDL::Ops::assgn|mismatched/ or not @not_a_ndarray || @mismatched_dims
3703 2 3 if (@mismatched_dims > 1) { }
1 2 elsif (@mismatched_dims) { }
3714 2 3 if (@not_a_ndarray > 1) { }
1 2 elsif (@not_a_ndarray) { }
3779 127 6 if ($#dims == 1) { }
3792 0 6 if $PDL::use_commas
3803 0 297 if $self->getndims != 1
3806 18 927 $format ? :
142 945 $badflag && $_ eq 'BAD' ? :
3815 127 0 if (not defined $format or $format eq "")
3819 11 116 if ($len > 7) { }
3820 0 11 if ($dtype == $PDL::Core::PDL_F) { }
7 4 elsif ($dtype == $PDL::Core::PDL_D) { }
2 2 elsif ($dtype == $PDL::Core::PDL_IND) { }
3835 2 4 $_ eq 'BAD' ? :
1 8 $badflag ? :
9 118 if $findmax
3841 22 3567 $badflag && $_ eq 'BAD' ? :
3851 0 127 if scalar @dims != 2
4257 0 3 if defined $pdl->gethdr or not defined $Astro::FITS::Header::VERSION
4273 7 0 $writable ? :
4274 7 0 $shared ? :
4275 0 7 if $PDL::debug
4278 0 7 if $PDL::debug
4285 7 0 $writable && $shared ? :
4286 2 5 if $creat
4287 0 7 unless sysopen my $fh, $name, $mode, $perms
4290 2 5 if ($trunc)
4291 0 2 unless truncate $fh, 0
4292 0 2 unless truncate $fh, $len
4300 0 3 unless $len