Branch Coverage

blib/lib/Geo/FIT.pm
Criterion Covered Total %
branch 279 574 48.6


line true false branch
60 18 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) { }
7143 0 18 if wantarray
7150 3 0 if (@_) { }
7152 0 3 if wantarray
7158 0 23 unless $str
7160 15 8 if ($minor >= 100)
7167 29 3 if (@_) { }
7169 10 19 if $version =~ /\./
7172 21 11 if (wantarray)
7175 11 10 if ($version >= 2200)
7187 1 6 if (builtin::blessed($self)) { }
7188 0 1 unless defined $self->{'profile_version'}
7189 0 1 if @_
7248 18 36 if (@_) { }
7259 13 1468 if (@_) { }
7270 13 1437 if (@_) { }
7281 1605 6102 if (@_) { }
7292 0 5920 if (@_) { }
7303 4 16 if (@_) { }
7314 13 13 if ($self->offset > 0)
7316 0 13 unless defined $self->crc
7338 12 26 if (@_)
7340 0 12 unless -f $fname
7360 13 0 if ($fn ne '') { }
7363 13 0 if ($fh->open("< $fn")) { }
7364 13 0 if (binmode $fh, ':raw') { }
7381 0 2939 if (@_) { }
7392 8 2 if (@_) { }
7403 8 1 if (@_) { }
7415 0 26 if @_
7421 18 8 if ($n > 0) { }
7424 5 13 if (defined $self->file_size)
7425 5 0 if (defined $self->crc) { }
7432 8 0 if (defined $n) { }
7447 26 2990 if (length($$buffer) - $offset < $bytes_needed) { }
7476 0 13 if $self->fh->tell < 0
7477 0 13 if $self->fh->tell > 0
7481 13 0 if ($self->_buffer_needs_updating($header_length))
7482 0 13 unless $self->fill_buffer
7492 0 13 if ($header_extra_bytes < 0)
7497 13 0 if ($header_extra_bytes)
7498 0 13 if ($self->_buffer_needs_updating($header_extra_bytes))
7499 0 0 unless $self->fill_buffer
7505 0 13 if ($sig != $FIT_signature)
7507 0 0 $_ ne '\\' && 32 >= ord $_ && ord $_ <= 126 ? :
7512 13 0 if ($proto_ver >= $protocol_version_header_crc_started and length $extra >= $header_crc_length)
7519 13 0 unless (defined $self->crc)
7542 0 1432 if $self->fh->tell == 0
7543 0 1432 if $self->fh->tell < 0
7547 8 1424 if ($self->_buffer_needs_updating($crc_octets))
7548 8 0 unless $self->fill_buffer
7555 1416 8 if ($j < $self->file_size) { }
0 8 elsif (not $self->maybe_chained and $j > $self->file_size) { }
7559 0 1416 if ($record_header & $rechd_mask_compressed_timestamp_header) { }
143 1273 elsif ($record_header & $rechd_mask_definition_message) { }
7570 1272 1 if (ref $desc eq 'HASH') { }
7580 0 8 unless defined $self->crc
7598 1 0 if (@_) { }
7600 1 0 if (ref $_[0] and ref $_[0] eq 'CODE') { }
7623 13 0 if (@_) { }
7629 13 0 if $fit ne ""
7637 0 13 if (ref $is_cb and ref $is_cb eq 'CODE') { }
7638 0 0 ref $is_cb_argv && ref $is_cb_argv eq 'ARRAY' ? :
7661 31 58 if (@_) { }
7680 10 8 if $over < 0
7682 18 0 if ($m > $over)
7700 8 1 if (@_) { }
7719 0 1 if (@_) { }
7728 7 675 if (@_) { }
7737 675 0 $self->use_gmtime ? :
7745 4 1034 if (ref $typedesc ne 'HASH') { }
22 1012 elsif ($typedesc->{'_mask'}) { }
679 333 elsif ($type_name eq 'date_time') { }
7748 3 19 if (not $val =~ /^[-+]?\d+$/) { }
7754 0 9 if ($expr =~ s/^0[xX]//) { }
7773 0 19 if ($rest) { }
19 0 elsif (@key) { }
7784 4 675 if (not $val =~ /^[-+]?\d+$/) { }
675 0 elsif ($val >= $typedesc->{'_min'} and $val != $invalid[$typedesc->{'_base_type'}]) { }
7787 4 0 $gmt ne '' ? :
7789 9 666 if ($self->numeric_date_time) { }
7805 0 1416 if (@_) { }
7808 12 1404 if ref $self->{'data_message_descriptor'} ne "ARRAY"
7836 0 0 if ($num == $msgnum_anon) { }
0 0 elsif (not defined($msgtype = $msgtype_by_num{$num})) { }
0 0 elsif (@_) { }
7837 0 0 if (@_) { }
7838 0 0 if (ref $_[0] eq 'CODE') { }
7847 0 0 if ref $cb eq "ARRAY"
7854 0 0 if (ref $_[0] eq 'CODE') { }
7856 0 0 if $msgtype->{'_name'} ne ""
7863 0 0 ref $cb eq 'ARRAY' ? :
7883 7 52 if ($name eq $msgname_anon) { }
0 52 elsif (not defined($msgtype = $msgtype_by_name{$name})) { }
52 0 elsif (@_) { }
7884 5 2 if (@_) { }
7885 5 0 if (ref $_[0] eq 'CODE') { }
7894 4 244 if ref $cb eq "ARRAY"
7901 52 0 if (ref $_[0] eq 'CODE') { }
7908 0 0 ref $cb eq 'ARRAY' ? :
7923 0 0 if (not defined $i_id) { }
0 0 elsif ($T_id != 2 and $T_id != 13) { }
0 0 elsif (not defined $i_index) { }
7934 0 0 if ($emsg ne "")
7935 0 0 if ($warn) { }
7944 0 0 unless ref $devdata_by_index eq "HASH"
7947 0 0 unless ref $devdata_by_id eq "HASH"
7950 0 0 if ($T_id == 2) { }
7972 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) { }
7992 0 0 if ($emsg ne "")
7993 0 0 if ($warn) { }
8003 0 0 if ($base_type == $I_base_type_id)
8008 0 0 if ($base_type < 0)
8015 0 0 unless ($base_type <= 16)
8022 0 0 unless (ref $devdata_by_index eq "HASH")
8029 0 0 if ($index == $I_index)
8036 0 0 if ($num == $I_field_num)
8043 0 0 unless (ref $devdata eq "HASH")
8049 0 0 unless ref $field_desc_by_num eq "HASH"
8052 0 0 unless ref $field_desc_by_name eq "HASH"
8056 0 0 if (defined $name)
8070 0 0 unless ($i_aname =~ /^i_(developer_data_index|field_definition_number|fit_base_type_id|field_name)$/)
8080 0 0 if ($desc->{$T_aname} == 7) { }
0 0 elsif ($v->[$i] != $desc->{$I_aname}) { }
8088 0 0 if defined $name
8095 0 3410 if ($endian != $my_endian and $size[$type] > 1) { }
8098 0 0 if ($size[$type] == 2) { }
0 0 elsif ($size[$type] == 4) { }
8117 0 143 if ($self->_buffer_needs_updating($defmsg_min_length))
8118 0 0 unless $self->fill_buffer
8123 0 143 $endian ? :
8128 0 143 if ($self->_buffer_needs_updating($len))
8129 0 0 unless $self->fill_buffer
8132 0 143 if $endian != $my_endian
8141 110 19 if ref $msgtype eq "HASH" and exists $msgtype->{'_name'}
8142 24 119 if ref $cbmap->{$msgnum} eq "ARRAY"
8143 119 24 if ref $cb ne "ARRAY"
8144 69 74 if ref $cb eq "ARRAY"
8153 3319 91 if (ref $msgtype eq "HASH")
8156 2620 699 if (ref $fldtype eq "HASH")
8164 790 2620 unless defined $name
8174 2207 1203 if %attr
8175 466 2944 if defined $tname
8186 0 3410 if ($packfactor[$type] > 1)
8191 225 3185 if $c > 1
8199 0 143 if ($record_header & $rechd_mask_devdata_message)
8201 0 0 if ($self->_buffer_needs_updating($devdata_min_length))
8202 0 0 unless $self->fill_buffer
8209 0 0 if ($self->_buffer_needs_updating($len))
8210 0 0 unless $self->fill_buffer
8216 0 0 if (ref $devdata_by_index ne "HASH")
8226 0 0 if (ref $devdata eq 'HASH') { }
8229 0 0 if (ref $fdesc_by_num eq 'HASH') { }
8238 0 0 if (ref $fdesc eq 'HASH') { }
8246 0 0 unless defined $name
8255 0 0 if %attr
8266 0 0 if ($packfactor[$type] > 1)
8271 0 0 if $c > 1
8276 0 0 if @emsg
8279 0 143 if @cvt
8280 0 143 if @pi
8308 233 0 if (@_) { }
8319 5 1267 if ($self->_buffer_needs_updating($desc->{'message_length'}))
8320 0 5 unless $self->fill_buffer
8322 0 1272 if ref $desc->{'endian_converter'} eq "ARRAY"
8328 0 1272 if (ref $desc->{'packfilter_index'} eq "ARRAY")
8339 0 0 if $i < $i_array_t
8353 749 523 if (ref $cb eq 'ARRAY') { }
8354 0 749 if $v[0] & $rechd_mask_compressed_timestamp_header
8366 0 0 if ($drop_devdata and $desc->{'message_name'} eq 'developer_data_id' || $desc->{'message_name'} eq 'field_description') { }
8371 0 0 if (ref $desc->{'packfilter_index'} eq "ARRAY")
8379 0 0 if $i < $i_array
8389 0 0 if ($drop_devdata) { }
8390 0 0 if ($desc->{'devdata_first'} > 0) { }
8415 0 68 if (ref $sw->{'_by'} eq 'ARRAY') { }
8425 66 2 if (defined $desc->{$i_name} and ($val = $$v[$desc->{$i_name}]) != $$desc{'I_' . $key})
8428 66 0 if (defined $key_tn)
8431 63 3 if defined $t_val
8434 51 15 if (ref $sw->{$val} eq "HASH")
8448 14 161 if $$v[$i + $j] == 0
8456 4661 0 if (ref $attr eq 'HASH') { }
8459 1956 2705 if defined $scale and $scale > 0
8460 623 4038 if $offset
8462 3525 1136 if (defined $unit) { }
20 1116 elsif (defined $scale and $scale > 0) { }
8465 1524 2001 if (ref $unit_tab eq "HASH")
8468 1524 0 if ($scale1 > 0)
8472 0 1524 if $offset1
8473 1524 0 if defined $unit1
8476 3242 283 if (defined $scale and $scale > 0) { }
22 261 elsif ($self->without_unit) { }
8479 2148 1094 if ($self->without_unit) { }
8503 35 0 if (ref $attr eq 'HASH') { }
8507 30 5 if (defined $unit)
8510 10 20 if (ref $unit_tab eq "HASH")
8513 10 0 if defined $scale1 and $scale1 > 0
8514 0 10 if $offset1
8515 10 0 if defined $unit1
8518 0 30 if length $num >= length $unit and substr($num, -length($unit)) eq $unit
8522 0 35 if $offset
8523 31 4 if defined $scale and $scale > 0
8543 0 44 if ref $desc ne "HASH"
8548 44 0 unless $opts{'keep_unknown'}
8579 223 194 if $values->[$index] != $$descriptor{'I_' . $field}
8617 14 129 if (defined $attr->{'switch'})
8619 13 1 if (ref $t_attr eq "HASH")
8626 143 0 if ($value != $invalid)
8627 74 69 if (defined $type_name)
8629 64 10 if defined $ret_val
8632 79 0 if (ref $attr eq "HASH")
8664 15 126 if (defined $attr->{'switch'})
8668 0 15 unless defined $optional_last_arg
8670 14 1 if (ref $optional_last_arg eq 'ARRAY') { }
8672 13 1 if (ref $t_attr eq "HASH")
8680 100 41 unless ($value =~ /^[-+]?\d+$/)
8681 65 35 if (defined $type_name)
8683 65 0 if defined $ret_val
8686 35 0 if (ref $attr eq "HASH")
8708 781 2858 if ($val == $invalid) { }
8711 393 2465 if (defined $tname)
8714 380 13 if defined $vname
8717 2478 0 if (ref $attr eq 'HASH') { }
8740 0 0 if (not $val =~ /^[-+]?\d+$/) { }
8741 0 0 if ($tname ne "")
8744 0 0 if defined $vnum
8747 0 0 if (ref $attr eq 'HASH') { }
8761 0 0 if ($s < 0)
8771 0 0 $sign < 0 ? :
8773 0 0 unless $hms =~ s/\./s/
8779 3 0 if (@_) { }
8848 243 0 unless defined $fh
8849 0 243 if $desc->{'array_length'} == $v->$#*
8859 32 3334 if (ref $attr->{'switch'} eq "HASH")
8862 17 15 if (ref $t_attr eq "HASH")
8876 1 3541 if isnan($$v[$i + $j])
8877 2746 795 if $$v[$i + $j] != $invalid
8880 3366 0 if ($j < $c or not $skip_invalid)
8881 370 2996 if (defined $tname)
8882 233 10 if $type == 6 and $tname eq "date_time" and $pname eq "timestamp"
8884 3366 0 $type_name[$type] ne '' ? :
8885 17 3349 if $name ne $pname
8886 620 2746 if $j >= $c
8889 5 3361 if ($type == 7) { }
8892 54 3307 if $c > 1
8897 1692 1669 if $v->[$i] ne $pval
8899 54 3307 if ($c > 1)
8905 0 174 if $v->[$j] ne $pval
8922 0 0 unless defined $fh
8923 0 0 if ($desc->{'array_length'} == $v->$#*)
8936 0 0 if (ref $attr->{'switch'} eq "HASH")
8939 0 0 if (ref $t_attr eq "HASH")
8953 0 0 if isnan($$v[$i + $j])
8954 0 0 if $$v[$i + $j] != $invalid
8957 0 0 if ($j < $c or not $skip_invalid)
8958 0 0 if $type == 6 and $tname eq "date_time" and $pname eq "timestamp"
8959 0 0 if $out
8962 0 0 if ($type == 7) { }
8965 0 0 if $c > 1
8969 0 0 if (&looks_like_number($pval)) { }
8975 0 0 if ($c > 1)
8981 0 0 if (&looks_like_number($pval)) { }
9012 20 675 if (@_) { }
0 675 elsif (ref $self eq '') { }
9013 0 20 if (ref $self eq '') { }
9039 28 3555 if (@_) { }
9048 7 3525 if (@_) { }
9069 20 0 $on ? :
9074 4 4 $on ? :
9090 10 0 if $fh->opened
9123 0 0 $mspec =~ /^\d+$/ ? :
9125 0 0 if (ref $msgtype eq 'HASH') { }
9134 0 0 $mspec =~ /^\d+$/ ? :
9136 0 0 if (ref $msgtype eq 'HASH') { }
9159 0 0 $mspec =~ /^\d+$/ ? :
9161 0 0 if (ref $msgtype eq "HASH")
9164 0 0 if ref $flddesc eq "HASH"
9171 0 0 $mspec =~ /^\d+$/ ? :
9173 0 0 if (ref $msgtype eq "HASH")
9176 0 0 if ref $flddesc eq "HASH"