Branch Coverage

blib/lib/PDLA/Core.pm
Criterion Covered Total %
branch 298 508 58.6


line true false branch
65 307 229 unless @_
66 14 215 scalar @_ > 1 ? :
471 1552 102 scalar @_ ? :
475 1552 102 if (defined $class) { }
518 775 169 ref $arg ? :
744 6 2 unless (&Scalar::Util::looks_like_number($op2) or &Scalar::Util::blessed($op2) and $op2->isa('PDLA'))
820 0 323 if $_[0]->isnull
821 1 322 unless $_[0]->nelem == 1
827 0 621 if ($_[2]) { }
850 0 97 if ('PDLA::Type' eq ref $t)
974 2 93 if $value eq '' or $value eq '[]'
982 10 83 if $value =~ /e\p{IsAlpha}/ or $value =~ /\p{IsAlpha}e/
994 4 79 if $value =~ /bad\B/ or $value =~ /\Bbad/
999 0 79 if $value =~ /\Bnan/ or $value =~ /nan\B/
1001 3 76 if $value =~ s/\bnan\b/ee/gi
1003 0 79 if $value =~ /IND\B/i
1005 0 79 if $value =~ s/1\.\#IND/ee/gi
1009 2 77 if $value =~ /INF\B/i
1011 1 76 if $value =~ s/1\.\#INF/Ee/gi
1013 2 75 if $value =~ /inf\B/ or $value =~ /\Binf/
1015 3 72 if $value =~ s/\binf\b/Ee/gi
1017 4 71 if $value =~ /pi\B/ or $value =~ /\Bpi/
1023 0 71 if ($has_nan and not $types[$type]->usenan)
1029 0 71 if $has_inf and not $types[$type]->usenan
1035 4 67 if (my($disallowed) = $value =~ /([^\[\]\+\-0-9;,.eE ]+)/)
1050 6 61 if ($value =~ /;/)
1077 0 67 if $value =~ /EE[+\-]/ or $value =~ /[+\-]EE/
1081 2 65 if (my($disallowed) = $value =~ /((\D+|\A)[eE]\d+)/)
1111 4 0 if ($_[0] =~ /(Argument ".*" isn't numeric)/) { }
0 0 elsif ($old_warn_handler) { }
1131 0 65 if $PDLA::Config{'BADVAL_USENAN'}
1133 59 6 if (ref $val eq 'ARRAY') { }
1135 31 28 if ($to_return->dim(-1) == 1)
1136 19 12 if ($to_return->dims > 1) { }
12 0 elsif ($to_return->dims == 1) { }
1150 6 0 if ($@) { }
1174 0 124 unless s/^\[//
1183 59 331 if (/^\[/) { }
8 323 elsif (s/^\+//) { }
32 291 elsif (s/^\-//) { }
16 275 elsif (s/^bad//i) { }
5 270 elsif (s/^inf//i or s/1\.\#INF//i) { }
3 267 elsif (s/^nan//i or s/^1\.\#IND//i) { }
2 265 elsif (s/^pi//i) { }
11 254 elsif (s/^e//i) { }
254 0 elsif (s/^([\d+\-e.]+)//i) { }
1184 0 59 if $expects_number
1190 1 7 if $expects_number
1196 1 31 if $expects_number
1209 1 2 if ($sign == -1) { }
1226 223 27 $sign > 0 ? :
1245 0 876 if ref $this
1246 103 773 ref $_[0] eq 'PDLA::Type' ? :
1247 315 561 @_ > 1 ? :
1249 19 857 unless (defined $value)
1250 0 0 if ($PDLA::debug and $PDLA::undefval)
1256 528 348 if ref $value eq 'ARRAY'
1261 341 7 if (ref \$value eq 'SCALAR') { }
7 0 elsif (blessed($value)) { }
1270 95 246 if (is_scalar_SvPOK($value) and $value =~ /inf/i || $value =~ /nan/i || !&Scalar::Util::looks_like_number($value)) { }
0 246 elsif ($PDLA::Core::Config{'ivsize'} < 8 and $PDLA::Core::pack[$new->get_datatype] eq 'q*') { }
1321 0 264 unless blessed($value)
1323 264 0 unless defined $option
1324 0 264 if ($value->is_inplace)
1367 0 8 if $PDLA::debug
1369 0 8 unless (ref($hdr) =~ /HASH/)
1370 0 0 if $PDLA::debug
1374 0 8 if ($tobj = tied %$hdr) { }
0 8 elsif (UNIVERSAL::can($hdr, 'copy')) { }
1375 0 0 if $PDLA::debug
1376 0 0 if (UNIVERSAL::can($tobj, 'copy'))
1379 0 0 if $PDLA::debug
1387 0 0 if (UNIVERSAL::isa($tobj, 'Astro::FITS::Header'))
1388 0 0 if $PDLA::debug
1392 0 0 if $PDLA::debug
1397 0 0 if $PDLA::debug
1402 0 8 if $PDLA::debug
1416 8 0 if (ref $val eq 'HASH')
1420 0 20 ref $value ? :
1425 0 0 if (ref $val eq 'ARRAY')
1428 0 0 ref $z ? :
1433 0 0 if (ref $val eq 'SCALAR')
1438 0 0 if (ref $val eq 'REF')
1444 0 0 if (UNIVERSAL::isa($val, 'PDLA'))
1446 0 0 if $h = $val->hdrcpy
1448 0 0 if $h
1452 0 0 if (UNIVERSAL::can($val, 'copy'))
1562 0 47 unless defined $dim
1563 5 42 if $dim < 0
1564 36 11 defined $size ? :
1566 0 47 if $dim < 0
1571 3 44 $dim_diff > 0 ? :
1572 3 44 $dim_diff > 0 ? :
1633 1326 1 if ($#_ < 2) { }
1639 0 1 if @dims > $ndims
1641 0 2 if $dim > $ndims - 1
1643 1 1 if $targd > $dim
1644 0 2 if $dimmark[$dim]++ > $dim
1647 0 1 if $targd > 0
1731 2 2 if ($str =~ s/[,]*\s*NOtherPars\s*=>\s*([0-9]+)\s*[,]*//)
1732 0 4 unless $str =~ /\s*([^(]+)\((.+)\)\s*$/x
1734 4 0 if $PDLA::debug
1738 0 4 if $args == 0
1746 4 0 if $PDLA::debug
1748 0 4 if $@
1950 0 10 if ($nids > 0)
2064 2 9 unless defined $str
2065 1 10 if $this->isnull
2070 45 45 if ($form =~ s/^%([-,0-9]*[.]?[0-9]*)(\w)$/%$1s/)
2071 0 45 unless defined $info{$2}
2113 80 71 unless defined $eps
2139 0 1 $_[0] =~ /\(.*\)/ ? :
2146 0 13 $#$_ > 1 && @$_[2] == 0 ? :
1 0 !ref($_) ? :
13 1 ref $_ eq 'ARRAY' ? :
1 14 !ref($_) && $_ eq 'X' ? :
2176 0 0 if (ref $pdl eq 'CODE')
2196 0 0 unless ($PDLA::nslice_warning_issued)
2205 94 1198 $ref =~ /^(REF|SCALAR|ARRAY|HASH|CODE|GLOB||)$/ ? :
2211 2 792 if $#_ > 1
2212 790 2 if blessed($_[1])
2213 2 0 if ref \$_[1] eq 'SCALAR' or ref $_[1] eq 'ARRAY'
2221 229 0 if (ref $_[2] eq 'PDLA::Type')
2222 137 92 if blessed($_[1])
2223 92 0 if $_[0] eq 'PDLA'
2225 0 0 if blessed($_[1])
2332 116 109 if ($pdl->is_inplace) { }
2336 1 108 if (defined $preferred) { }
2339 0 1 if ref $preferred eq 'ARRAY'
2341 0 1 if ($preferred =~ /(^|\,)$s(\,|$)/i) { }
2412 92 325 ref $_[0] eq 'PDLA::Type' ? :
2415 0 752 if (ref $_) { }
2416 0 0 unless $_->isa('PDLA')
2417 0 0 if $_->getndims > 1
2419 0 0 if $_->nelem > 10
2423 738 14 if ($_) { }
2424 0 738 if $_ < 0
2434 10 407 if $PDLA::debug
2529 1 152 ref $_[0] && ref $_[0] ne 'PDLA::Type' ? :
2532 196 17 scalar @_ ? :
2570 5 44 ref $_[0] && ref $_[0] ne 'PDLA::Type' ? :
2573 45 33 scalar @_ ? :
2645 6 21 if (@_ == 2 and $_[1] == -1)
2646 5 6 $_ == 1 ? :
2652 2 28 if $dim < 0
2653 1 18 if @dims == 0
2656 0 19 if ($pdl->nelem > $nelem)
2705 63 146 $_[0]->getndims != 1 ? :
2733 0 169 if $#_ != 1
2735 0 169 unless ref $pdl
2736 140 29 if ref $type eq 'PDLA::Type'
2737 0 169 unless &Scalar::Util::looks_like_number($type)
2738 38 131 if $pdl->get_datatype == $type
2857 0 218 if ($PDLA::_STRINGIZING)
2862 0 216 if ($self->nelem > $PDLA::toolongtoprint)
2865 65 151 if ($ndims == 0)
2866 6 59 if ($self->badflag and $self->isbad) { }
2870 0 59 $format ? :
2873 0 151 if $self->isnull
2874 6 145 if $self->isempty
2875 0 145 $PDLA::use_commas ? :
2876 0 145 $PDLA::use_commas ? :
2877 94 51 if ($ndims == 1) { }
2884 2 216 if ($@)
2926 0 6 if $#_ != 0
2928 0 6 if nelem($pdl) == 0
2970 0 6 if $#_ != 0
2972 0 6 if $pdl->nelem == 0
2978 4 11 if ($pdl->ndims > 1) { }
3011 0 0 if $#_ != 0
3013 0 0 if nelem($pdl) == 0
3014 0 0 if scalar dims($pdl) != 1
3048 0 21 if $#_ < 2
3084 0 1453 if $#_ < 0
3135 220 1 if (ref $this) { }
3136 0 220 if $chkmode == 1 and $this->nelem > 1
3138 2 218 if $chkmode == 2 and $this->nelem > 1
3143 0 1 if (lc $check eq 'warn') { }
1 0 elsif (lc $check eq 'barf') { }
3145 0 0 $check != 0 ? :
3211 1 53 if not defined $resdims[$j] or $resdims[$j] == 1
3212 2 52 if $d[$j] != 1 and $resdims[$j] != $d[$j]
3220 0 37 if ($_->badflag)
3222 15 5 if ($@ eq '')
3231 5 0 if ($@ =~ /PDLA::Ops::assgn|mismatched/ or $@ =~ /"badflag"/ or $@ =~ /"initialize"/) { }
3239 3 2 if ($@ =~ /"initialize"/)
3241 0 3 unless @_
3252 5 0 if ref($_[$i]) =~ /PDLA/
3258 4 12 if (not eval { do { $arg->isa('PDLA') } }) { }
3 9 elsif (@dims != $arg->ndims) { }
3268 2 7 if ($dims[$j] != $arg->dim($j))
3279 2 3 if (@mismatched_dims > 1) { }
1 2 elsif (@mismatched_dims) { }
3291 2 3 if (@not_a_piddle > 1) { }
1 2 elsif (@not_a_piddle) { }
3302 0 5 if (@not_a_piddle == 0 and @mismatched_dims == 0)
3362 0 7 if ref $_[-1] eq 'HASH'
3367 0 21 if $opt->{'Break'}
3382 0 0 if (ref $x eq 'ARRAY') { }
0 0 elsif (ref $x eq 'PDLA') { }
3384 0 0 if (defined $dims[$level]) { }
3385 0 0 unless $dims[$level] == scalar @$x
3391 0 0 if ($type) { }
3394 0 0 unless $type eq ref $_
3400 0 0 defined $_ ? :
3413 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)) { }
3444 54 1 if ($#dims == 1) { }
3457 0 1 if $PDLA::use_commas
3468 0 94 if $self->getndims != 1
3473 1 93 if $dtype == $PDLA::Core::PDLA_F
3474 71 23 if $dtype == $PDLA::Core::PDLA_D
3475 2 92 if $dtype == $PDLA::Core::PDLA_IND
3479 73 412 if ($badflag and $t eq 'BAD') { }
0 412 elsif ($format) { }
3484 8 404 if ($dformat and length $t > 7)
3501 0 54 if scalar @dims != 2
3509 54 0 if (not defined $format or $format eq '')
3513 8 46 if ($badflag) { }
3515 27 43 if ($_ eq 'BAD') { }
3517 13 57 $i > $len ? :
3520 56 630 $i > $len ? :
3525 0 54 if ($len > 7) { }
3526 0 0 if ($dtype == $PDLA::Core::PDLA_F) { }
0 0 elsif ($dtype == $PDLA::Core::PDLA_D) { }
0 0 elsif ($dtype == $PDLA::Core::PDLA_IND) { }
3543 0 54 if ($findmax)
3547 0 0 if ($badflag) { }
3549 0 0 if ($_ eq 'BAD') { }
3551 0 0 $i > $len ? :
3555 0 0 $i > $len ? :
3566 27 729 if ($badflag and $x->[$i] eq 'BAD') { }
3572 6 750 if $t > 0
3574 574 182 if (($i + 1) % $dims[0]) { }
3579 54 128 if ($i == $#$x) { }
3960 0 0 if defined $pdl->gethdr or not defined $Astro::FITS::Header::VERSION
3977 0 77 if ($@)
3978 0 0 if $PDLA::verbose
4006 0 0 $writable && $shared ? :
0 0 $creat ? :
0 0 unless sysopen my $fh, $name, ($writable && $shared ? 2 : 0) | ($creat ? 64 : 0), $mode
4011 0 0 if ($trunc)
4012 0 0 unless truncate $fh, 0
4013 0 0 unless truncate $fh, $len
4016 0 0 if ($len) { }
4020 0 0 if ($PDLA::debug)
4021 0 0 $writable ? :
0 0 $shared ? :
4032 0 0 $writable ? :
0 0 $shared ? :
4047 0 0 if ($PDLA::debug)