Branch Coverage

blib/lib/Geo/FIT.pm
Criterion Covered Total %
branch 227 574 39.5


line true false branch
60 8 0 unless (defined $uint64_invalid)
205 0 0 if ($_[0]->bcmp(0) < 0) { }
213 0 0 if ($_[0]->bcmp(0) < 0) { }
226 0 0 if ($n->band($sint64_2c_sign)->bcmp(0) == 0) { }
6740 0 8 if wantarray
6747 0 0 if (@_) { }
6749 0 0 if wantarray
6755 0 15 unless $str
6757 7 8 if ($minor >= 100)
6764 16 3 if (@_) { }
6766 6 10 if $version =~ /\./
6769 12 7 if (wantarray)
6772 5 7 if ($version >= 2200)
6784 1 4 if (&blessed($self)) { }
6785 0 1 unless defined $self->{'profile_version'}
6786 0 1 if @_
6845 9 18 if (@_) { }
6856 7 625 if (@_) { }
6867 4 609 if (@_) { }
6878 696 2625 if (@_) { }
6889 0 2533 if (@_) { }
6900 0 4 if (@_) { }
6911 4 7 if ($self->offset > 0)
6913 0 4 unless defined $self->crc
6935 6 12 if (@_)
6937 0 6 unless -f $fname
6957 7 0 if ($fn ne '') { }
6960 7 0 if ($fh->open("< $fn")) { }
6961 7 0 if (binmode $fh, ':raw') { }
6978 0 1253 if (@_) { }
6989 2 0 if (@_) { }
7000 2 0 if (@_) { }
7012 0 11 if @_
7018 9 2 if ($n > 0) { }
7021 2 7 if (defined $self->file_size)
7022 2 0 if (defined $self->crc) { }
7029 2 0 if (defined $n) { }
7044 11 1286 if (length($$buffer) - $offset < $bytes_needed) { }
7073 0 7 if $self->fh->tell < 0
7074 0 7 if $self->fh->tell > 0
7078 7 0 if ($self->_buffer_needs_updating($header_length))
7079 0 7 unless $self->fill_buffer
7089 0 7 if ($header_extra_bytes < 0)
7094 7 0 if ($header_extra_bytes)
7095 0 7 if ($self->_buffer_needs_updating($header_extra_bytes))
7096 0 0 unless $self->fill_buffer
7102 0 7 if ($sig != $FIT_signature)
7104 0 0 $_ ne '\\' && 32 >= ord $_ && ord $_ <= 126 ? :
7109 7 0 if ($proto_ver >= $protocol_version_header_crc_started and length $extra >= $header_crc_length)
7116 7 0 unless (defined $self->crc)
7139 0 607 if $self->fh->tell == 0
7140 0 607 if $self->fh->tell < 0
7144 2 605 if ($self->_buffer_needs_updating($crc_octets))
7145 2 0 unless $self->fill_buffer
7152 603 2 if ($j < $self->file_size) { }
0 2 elsif (not $self->maybe_chained and $j > $self->file_size) { }
7156 0 603 if ($record_header & $rechd_mask_compressed_timestamp_header) { }
74 529 elsif ($record_header & $rechd_mask_definition_message) { }
7167 528 1 if (ref $desc eq 'HASH') { }
7177 0 2 unless defined $self->crc
7195 1 0 if (@_) { }
7197 1 0 if (ref $_[0] and ref $_[0] eq 'CODE') { }
7220 5 0 if (@_) { }
7226 5 0 if $fit ne ""
7234 0 5 if (ref $is_cb and ref $is_cb eq 'CODE') { }
7235 0 0 ref $is_cb_argv && ref $is_cb_argv eq 'ARRAY' ? :
7258 16 24 if (@_) { }
7277 7 2 if $over < 0
7279 9 0 if ($m > $over)
7297 2 0 if (@_) { }
7316 0 0 if (@_) { }
7325 2 6 if (@_) { }
7334 6 0 $self->use_gmtime ? :
7342 2 170 if (ref $typedesc ne 'HASH') { }
6 164 elsif ($typedesc->{'_mask'}) { }
10 154 elsif ($type_name eq 'date_time') { }
7345 3 3 if (not $val =~ /^[-+]?\d+$/) { }
7351 0 9 if ($expr =~ s/^0[xX]//) { }
7370 0 3 if ($rest) { }
3 0 elsif (@key) { }
7381 4 6 if (not $val =~ /^[-+]?\d+$/) { }
6 0 elsif ($val >= $typedesc->{'_min'} and $val != $invalid[$typedesc->{'_base_type'}]) { }
7384 4 0 $gmt ne '' ? :
7386 0 6 if ($self->numeric_date_time) { }
7402 0 603 if (@_) { }
7405 6 597 if ref $self->{'data_message_descriptor'} ne "ARRAY"
7433 0 0 if ($num == $msgnum_anon) { }
0 0 elsif (not defined($msgtype = $msgtype_by_num{$num})) { }
0 0 elsif (@_) { }
7434 0 0 if (@_) { }
7435 0 0 if (ref $_[0] eq 'CODE') { }
7444 0 0 if ref $cb eq "ARRAY"
7451 0 0 if (ref $_[0] eq 'CODE') { }
7453 0 0 if $msgtype->{'_name'} ne ""
7460 0 0 ref $cb eq 'ARRAY' ? :
7480 2 26 if ($name eq $msgname_anon) { }
0 26 elsif (not defined($msgtype = $msgtype_by_name{$name})) { }
26 0 elsif (@_) { }
7481 1 1 if (@_) { }
7482 1 0 if (ref $_[0] eq 'CODE') { }
7491 2 96 if ref $cb eq "ARRAY"
7498 26 0 if (ref $_[0] eq 'CODE') { }
7505 0 0 ref $cb eq 'ARRAY' ? :
7520 0 0 if (not defined $i_id) { }
0 0 elsif ($T_id != 2 and $T_id != 13) { }
0 0 elsif (not defined $i_index) { }
7531 0 0 if ($emsg ne "")
7532 0 0 if ($warn) { }
7541 0 0 unless ref $devdata_by_index eq "HASH"
7544 0 0 unless ref $devdata_by_id eq "HASH"
7547 0 0 if ($T_id == 2) { }
7569 0 0 if (not defined $i_index) { }
0 0 elsif (not defined $i_field_num) { }
0 0 elsif (not defined $i_base_type_id) { }
0 0 elsif ($T_base_type_id != 2) { }
0 0 elsif (not defined $i_field_name) { }
0 0 elsif ($T_field_name != 7 or $c_field_name <= 0) { }
7589 0 0 if ($emsg ne "")
7590 0 0 if ($warn) { }
7600 0 0 if ($base_type == $I_base_type_id)
7605 0 0 if ($base_type < 0)
7612 0 0 unless ($base_type <= 16)
7619 0 0 unless (ref $devdata_by_index eq "HASH")
7626 0 0 if ($index == $I_index)
7633 0 0 if ($num == $I_field_num)
7640 0 0 unless (ref $devdata eq "HASH")
7646 0 0 unless ref $field_desc_by_num eq "HASH"
7649 0 0 unless ref $field_desc_by_name eq "HASH"
7653 0 0 if (defined $name)
7667 0 0 unless ($i_aname =~ /^i_(developer_data_index|field_definition_number|fit_base_type_id|field_name)$/)
7677 0 0 if ($desc->{$T_aname} == 7) { }
0 0 elsif ($v->[$i] != $desc->{$I_aname}) { }
7685 0 0 if defined $name
7692 0 1730 if ($endian != $my_endian and $size[$type] > 1) { }
7695 0 0 if ($size[$type] == 2) { }
0 0 elsif ($size[$type] == 4) { }
7714 0 74 if ($self->_buffer_needs_updating($defmsg_min_length))
7715 0 0 unless $self->fill_buffer
7720 0 74 $endian ? :
7725 0 74 if ($self->_buffer_needs_updating($len))
7726 0 0 unless $self->fill_buffer
7729 0 74 if $endian != $my_endian
7738 56 10 if ref $msgtype eq "HASH" and exists $msgtype->{'_name'}
7739 12 62 if ref $cbmap->{$msgnum} eq "ARRAY"
7740 62 12 if ref $cb ne "ARRAY"
7741 28 46 if ref $cb eq "ARRAY"
7750 1678 52 if (ref $msgtype eq "HASH")
7753 1314 364 if (ref $fldtype eq "HASH")
7761 416 1314 unless defined $name
7771 1096 634 if %attr
7772 238 1492 if defined $tname
7783 0 1730 if ($packfactor[$type] > 1)
7788 108 1622 if $c > 1
7796 0 74 if ($record_header & $rechd_mask_devdata_message)
7798 0 0 if ($self->_buffer_needs_updating($devdata_min_length))
7799 0 0 unless $self->fill_buffer
7806 0 0 if ($self->_buffer_needs_updating($len))
7807 0 0 unless $self->fill_buffer
7813 0 0 if (ref $devdata_by_index ne "HASH")
7823 0 0 if (ref $devdata eq 'HASH') { }
7826 0 0 if (ref $fdesc_by_num eq 'HASH') { }
7835 0 0 if (ref $fdesc eq 'HASH') { }
7843 0 0 unless defined $name
7852 0 0 if %attr
7863 0 0 if ($packfactor[$type] > 1)
7868 0 0 if $c > 1
7873 0 0 if @emsg
7876 0 74 if @cvt
7877 0 74 if @pi
7905 0 0 if (@_) { }
7916 2 526 if ($self->_buffer_needs_updating($desc->{'message_length'}))
7917 0 2 unless $self->fill_buffer
7919 0 528 if ref $desc->{'endian_converter'} eq "ARRAY"
7925 0 528 if (ref $desc->{'packfilter_index'} eq "ARRAY")
7936 0 0 if $i < $i_array_t
7950 45 483 if (ref $cb eq 'ARRAY') { }
7951 0 45 if $v[0] & $rechd_mask_compressed_timestamp_header
7963 0 0 if ($drop_devdata and $desc->{'message_name'} eq 'developer_data_id' || $desc->{'message_name'} eq 'field_description') { }
7968 0 0 if (ref $desc->{'packfilter_index'} eq "ARRAY")
7976 0 0 if $i < $i_array
7986 0 0 if ($drop_devdata) { }
7987 0 0 if ($desc->{'devdata_first'} > 0) { }
8012 0 29 if (ref $sw->{'_by'} eq 'ARRAY') { }
8022 29 0 if (defined $desc->{$i_name} and ($val = $$v[$desc->{$i_name}]) != $$desc{"I_" . $key})
8025 29 0 if (defined $key_tn)
8028 27 2 if defined $t_val
8031 27 2 if (ref $sw->{$val} eq "HASH")
8045 0 0 if $$v[$i + $j] == 0
8053 89 0 if (ref $attr eq 'HASH') { }
8056 29 60 if defined $scale and $scale > 0
8057 2 87 if $offset
8059 58 31 if (defined $unit) { }
7 24 elsif (defined $scale and $scale > 0) { }
8062 14 44 if (ref $unit_tab eq "HASH")
8065 14 0 if ($scale1 > 0)
8069 0 14 if $offset1
8070 14 0 if defined $unit1
8073 36 22 if (defined $scale and $scale > 0) { }
22 0 elsif ($self->without_unit) { }
8076 36 0 if ($self->without_unit) { }
8100 35 0 if (ref $attr eq 'HASH') { }
8104 30 5 if (defined $unit)
8107 10 20 if (ref $unit_tab eq "HASH")
8110 10 0 if defined $scale1 and $scale1 > 0
8111 0 10 if $offset1
8112 10 0 if defined $unit1
8115 0 30 if length $num >= length $unit and substr($num, -length($unit)) eq $unit
8119 0 35 if $offset
8120 31 4 if defined $scale and $scale > 0
8140 0 44 if ref $desc ne "HASH"
8144 44 0 unless $opts{'keep_unknown'}
8171 222 194 if $values->[$index] != $$descriptor{"I_" . $field}
8209 14 129 if (defined $attr->{'switch'})
8211 13 1 if (ref $t_attr eq "HASH")
8218 143 0 if ($value != $invalid)
8219 74 69 if (defined $type_name)
8221 64 10 if defined $ret_val
8224 79 0 if (ref $attr eq "HASH")
8256 15 126 if (defined $attr->{'switch'})
8260 0 15 unless defined $optional_last_arg
8262 14 1 if (ref $optional_last_arg eq 'ARRAY') { }
8264 13 1 if (ref $t_attr eq "HASH")
8272 100 41 unless ($value =~ /^[-+]?\d+$/)
8273 65 35 if (defined $type_name)
8275 65 0 if defined $ret_val
8278 35 0 if (ref $attr eq "HASH")
8300 0 0 if ($val == $invalid) { }
8303 0 0 if (defined $tname)
8306 0 0 if defined $vname
8309 0 0 if (ref $attr eq 'HASH') { }
8332 0 0 if (not $val =~ /^[-+]?\d+$/) { }
8333 0 0 if ($tname ne "")
8336 0 0 if defined $vnum
8339 0 0 if (ref $attr eq 'HASH') { }
8353 0 0 if ($s < 0)
8363 0 0 $sign < 0 ? :
8365 0 0 unless $hms =~ s/\./s/
8371 0 0 if (@_) { }
8440 0 0 unless defined $fh
8441 0 0 if $desc->{'array_length'} == $#$v
8451 0 0 if (ref $attr->{'switch'} eq "HASH")
8454 0 0 if (ref $t_attr eq "HASH")
8468 0 0 if isnan($$v[$i + $j])
8469 0 0 if $$v[$i + $j] != $invalid
8472 0 0 if ($j < $c or not $skip_invalid)
8473 0 0 if (defined $tname)
8474 0 0 if $type == 6 and $tname eq "date_time" and $pname eq "timestamp"
8476 0 0 $type_name[$type] ne '' ? :
8477 0 0 if $name ne $pname
8478 0 0 if $j >= $c
8481 0 0 if ($type == 7) { }
8484 0 0 if $c > 1
8489 0 0 if $v->[$i] ne $pval
8491 0 0 if ($c > 1)
8497 0 0 if $v->[$j] ne $pval
8514 0 0 unless defined $fh
8515 0 0 if ($desc->{'array_length'} == $#$v)
8528 0 0 if (ref $attr->{'switch'} eq "HASH")
8531 0 0 if (ref $t_attr eq "HASH")
8545 0 0 if isnan($$v[$i + $j])
8546 0 0 if $$v[$i + $j] != $invalid
8549 0 0 if ($j < $c or not $skip_invalid)
8550 0 0 if $type == 6 and $tname eq "date_time" and $pname eq "timestamp"
8551 0 0 if $out
8554 0 0 if ($type == 7) { }
8557 0 0 if $c > 1
8561 0 0 if (&looks_like_number($pval)) { }
8567 0 0 if ($c > 1)
8573 0 0 if (&looks_like_number($pval)) { }
8604 8 6 if (@_) { }
0 6 elsif (ref $self eq '') { }
8605 0 8 if (ref $self eq '') { }
8631 10 88 if (@_) { }
8640 2 58 if (@_) { }
8661 8 0 $on ? :
8666 0 2 $on ? :
8682 7 0 if $fh->opened
8715 0 0 $mspec =~ /^\d+$/ ? :
8717 0 0 if (ref $msgtype eq 'HASH') { }
8726 0 0 $mspec =~ /^\d+$/ ? :
8728 0 0 if (ref $msgtype eq 'HASH') { }
8751 0 0 $mspec =~ /^\d+$/ ? :
8753 0 0 if (ref $msgtype eq "HASH")
8756 0 0 if ref $flddesc eq "HASH"
8763 0 0 $mspec =~ /^\d+$/ ? :
8765 0 0 if (ref $msgtype eq "HASH")
8768 0 0 if ref $flddesc eq "HASH"