Branch Coverage

blib/lib/RRD/Editor.pm
Criterion Covered Total %
branch 280 450 62.2


line true false branch
47 6 0 if ($endiantest eq 'c92a329bcf04f804') { }
0 0 elsif ($endiantest eq '04f804cf9b322ac9') { }
0 0 elsif ($endiantest eq 'cf04f804c92a329b') { }
95 0 0 if ($RRD::Editor::Config{'myarchname'} =~ /(sun|sparc|mips|irix|ppc|powerpc|arm)/i and !1) { }
125 6 0 if (_isNan($nan))
135 0 0 if (_isNan($nan))
144 6 0 if (_isInf($inf))
154 0 0 if (_isInf($inf))
160 232 573 if (_isNan($_[0])) { }
19 554 elsif (_isInf($_[0])) { }
19 535 elsif (_isInf(-$_[0])) { }
168 535 0 if ($_[1])
170 0 535 if ($str =~ /^([+|-]?\d*[.]?\d*e[+|-]?)0(\d\d)$/)
176 38 2 if (_isNan($_[0])) { }
0 2 elsif (_isInf($_[0])) { }
0 2 elsif (_isInf(-$_[0])) { }
237 2 342 if (defined $_[2])
239 0 344 if ($encoding eq 'native-double-simple' or $encoding eq 'native-double-mixed') { }
6 338 elsif ($encoding eq 'native-single') { }
0 338 elsif ($PACK_LITTLE_ENDIAN_SUPPORT and $encoding eq 'litteendian-single') { }
136 202 elsif ($PACK_LITTLE_ENDIAN_SUPPORT and $encoding eq 'littleendian-double') { }
253 75 127 if ($encoding eq 'portable-single' or $encoding eq 'ieee-32') { }
127 0 elsif ($encoding eq 'portable-double' or $encoding eq 'ieee-64') { }
257 16 143 if (_isNan($f)) { }
4 139 elsif ($f == -9**9**9) { }
4 135 elsif ($f == 9**9**9) { }
92 43 elsif ($f == 0) { }
266 1 42 $f < 0 ? :
267 1 42 $f < 0 ? :
285 136 237 if (_isNan($f)) { }
4 233 elsif ($f == -9**9**9) { }
4 229 elsif ($f == 9**9**9) { }
93 136 elsif ($f == 0) { }
294 11 125 $f < 0 ? :
295 11 125 $f < 0 ? :
322 30 557 if (defined $_[2])
324 0 587 if ($encoding eq 'native-double-simple' or $encoding eq 'native-double-mixed') { }
19 568 elsif ($encoding eq 'native-single') { }
6 562 elsif ($PACK_LITTLE_ENDIAN_SUPPORT and $encoding eq 'littleendian-single') { }
525 37 elsif ($PACK_LITTLE_ENDIAN_SUPPORT and $encoding eq 'littleendian-double') { }
338 6 31 if ($encoding eq 'portable-single' or $encoding eq 'ieee-32') { }
31 0 elsif ($encoding eq 'portable-double' or $encoding eq 'ieee-64') { }
344 5 1 $word & 2147483648 ? :
345 0 6 if ($expo == 128 and $mant == 0) { }
0 6 elsif ($expo == 128) { }
0 6 elsif ($expo == -127 and $mant == 0) { }
346 0 0 $sign > 0 ? :
364 9 97 $word & 2147483648 ? :
365 0 106 if ($expo == 1024 and $mantlo == 0 and $manthi == 0) { }
16 90 elsif ($expo == 1024) { }
1 89 elsif ($expo == -1023 and $manthi == 0 and $mantlo == 0) { }
386 0 39 if ($self->{'encoding'} eq 'native-double-simple' or $self->{'encoding'} eq 'native-double-mixed') { }
404 0 10 if ($self->{'encoding'} eq 'native-double-simple' or $self->{'encoding'} eq 'native-double-mixed') { }
2 8 elsif ($self->{'encoding'} eq 'littleendian-single' or $self->{'encoding'} eq 'native-single' or $self->{'encoding'} eq 'portable-single' or $self->{'encoding'} eq 'ieee-32') { }
8 0 elsif ($self->{'encoding'} eq 'littleendian-double' or $self->{'encoding'} eq 'portable-double' or $self->{'encoding'} eq 'ieee-64') { }
511 0 120 if ($self->{'encoding'} eq 'native-double-simple' or $self->{'encoding'} eq 'native-double-mixed') { }
20 100 elsif ($self->{'encoding'} eq 'native-single') { }
548 0 4 unless (defined $self->{'fd'})
573 23 16 if ($rrd->{'ds'}[$i]{'name'} eq $name)
617 0 8 if ($rraidx > $rrd->{'rra_cnt'} or $rraidx < 0)
624 0 0 if ($rraidx > $rrd->{'rra_cnt'} or $rraidx < 0)
631 0 2 if ($rraidx > $rrd->{'rra_cnt'} or $rraidx < 0)
638 0 2 if ($idx > $rrd->{'rra_cnt'} or $idx < 0)
648 0 3 if ($rraidx > $rrd->{'rra_cnt'} or $rraidx < 0)
650 0 3 if ($tidx >= $rrd->{'rra'}[$rraidx]{'row_cnt'} or $tidx < 0)
653 0 3 unless (defined $rrd->{'dataloaded'})
669 1 0 unless (defined $rrd->{'dataloaded'})
709 0 2 if ($idx < 0)
717 0 1 if ($hb < $rrd->{'pdp_step'})
719 0 1 if ($idx < 0)
729 0 1 if ($idx < 0)
737 0 1 if ($idx < 0)
747 0 1 if ($idx < 0)
755 0 1 if ($idx < 0)
765 0 2 if ($idx < 0)
773 0 1 if ($idx < 0)
774 0 1 unless ($type =~ /(GAUGE|COUNTER|DERIVE|ABSOLUTE)/)
783 0 1 if ($idx < 0)
792 0 1 unless ($arg =~ /^DS:([a-zA-Z0-9_\-]+):(GAUGE|COUNTER|DERIVE|ABSOLUTE):([0-9]+):(U|[-\+]?[0-9\.]+):(U|[-\+]?[0-9\.]+)$/)
795 1 0 unless (defined $rrd->{'dataloaded'})
799 1 0 if ($min eq 'U')
800 1 0 if ($max eq 'U')
827 0 1 if ($idx < 0)
830 0 1 unless (defined $rrd->{'dataloaded'})
864 0 1 unless ($args =~ /^RRA:(AVERAGE|MAX|MIN|LAST):([0-9\.]+):([0-9]+):([0-9]+)$/)
866 0 1 unless (defined $rrd->{'dataloaded'})
869 0 1 if ($4 < 1)
870 0 1 if ($2 < 0 or $2 > 1)
871 0 1 if ($3 < 1)
892 3 6 if ($idx >= $rrd->{'rra_cnt'} or $idx < 0)
894 0 6 unless (defined $rrd->{'dataloaded'})
904 2 7 if ($idx >= $rrd->{'rra_cnt'} or $idx < 0)
905 0 7 if ($size < 0)
907 0 7 unless (defined $rrd->{'dataloaded'})
913 2 5 if ($size > $row_cnt) { }
5 0 elsif ($size < $row_cnt) { }
919 3 2 $ptr + 1 + $cnt_strip > $row_cnt ? :
920 4 1 if $tail > 0
923 3 2 if $tail < $cnt_strip
933 0 1 if ($idx >= $rrd->{'rra_cnt'} or $idx < 0)
954 10 0 if (defined $rrd->{'dataloaded'}) { }
957 0 0 if (defined $self->{'fd'}) { }
959 0 0 unless CORE::open $self->{'fd'}, '+<', $self->{'file_name'}
971 8 2 if (@tmp == 0) { }
977 0 7 if ($idx[$i] < 0)
985 0 10 if ($args->[$i] =~ /(-t|--template)/)
986 0 10 if ($args->[$i] =~ /\@/)
988 0 10 if (@bits - 1 < @idx)
990 0 10 if ($bits[0] eq 'N') { }
996 0 10 if ($current_time < $rrd->{'last_up'})
1008 0 40 if ($rrd->{'ds'}[$j]{'hb'} < $interval)
1012 39 1 if ($updvals[$j] ne 'U' and $rrd->{'ds'}[$j]{'hb'} >= $interval) { }
1014 10 29 if ($rrd->{'ds'}[$j]{'type'} eq 'COUNTER') { }
9 20 elsif ($rrd->{'ds'}[$j]{'type'} eq 'DERIVE') { }
10 10 elsif ($rrd->{'ds'}[$j]{'type'} eq 'GAUGE') { }
1015 0 10 unless ($updvals[$j] =~ /^\d+$/)
1016 9 1 if ($rrd->{'ds'}[$j]{'pdp_prep'}{'last_ds'} ne 'U') { }
1020 3 6 if ($pdp_new[$j] < 0)
1021 0 9 if ($pdp_new[$j] < 0)
1027 0 9 unless ($updvals[$j] =~ /^[+|-]?\d+$/)
1028 8 1 if ($rrd->{'ds'}[$j]{'pdp_prep'}{'last_ds'} ne 'U') { }
1036 0 10 unless ($updvals[$j] =~ /^(-)?[\d]+(\.[\d]+)?$/)
1043 0 37 if (not _isNan($rate) and !_isNan($rrd->{'ds'}[$j]{'max'}) && $rate > $rrd->{'ds'}[$j]{'max'} || !_isNan($rrd->{'ds'}[$j]{'min'}) && $rate < $rrd->{'ds'}[$j]{'min'})
1060 10 0 if ($occu_pdp_st > $proc_pdp_st) { }
1071 0 10 if ($elapsed_pdp_st == 0) { }
1074 0 0 if (_isNan($pdp_new[$j])) { }
0 0 elsif (_isNan($rrd->{'ds'}[$j]{'pdp_prep'}{'val'})) { }
1090 3 37 if (_isNan($pdp_new[$j])) { }
1094 2 35 if (_isNan($rrd->{'ds'}[$j]{'pdp_prep'}{'val'}))
1100 5 35 if ($interval > $rrd->{'ds'}[$j]{'hb'} or $rrd->{'pdp_step'} / 2 < $rrd->{'ds'}[$j]{'pdp_prep'}{'unkn_sec_cnt'} + $pre_unknown) { }
1106 3 37 if (_isNan($pdp_new[$j])) { }
1121 30 20 if ($start_pdp_offset <= $elapsed_pdp_st) { }
1128 160 40 if ($rrd->{'rra'}[$ii]{'pdp_cnt'} > 1) { }
1130 80 80 if ($rra_step_cnt[$ii] > 0) { }
1131 16 64 if (_isNan($pdp_temp[$j])) { }
1137 16 64 if ($rrd->{'rra'}[$ii]{'cdp_prep'}[$j][1] > $rrd->{'rra'}[$ii]{'pdp_cnt'} * $rrd->{'rra'}[$ii]{'xff'}) { }
1141 16 48 if ($rrd->{'rra'}[$ii]{'name'} eq 'AVERAGE') { }
16 32 elsif ($rrd->{'rra'}[$ii]{'name'} eq 'MAX') { }
16 16 elsif ($rrd->{'rra'}[$ii]{'name'} eq 'MIN') { }
1142 0 16 if (_isNan($rrd->{'rra'}[$ii]{'cdp_prep'}[$j][0])) { }
1147 0 16 if (_isNan($pdp_temp[$j])) { }
1154 0 16 if (_isNan($rrd->{'rra'}[$ii]{'cdp_prep'}[$j][0])) { }
1159 0 16 if (_isNan($pdp_temp[$j])) { }
1164 8 8 if ($cur_val > $cum_val) { }
1170 0 16 if (_isNan($rrd->{'rra'}[$ii]{'cdp_prep'}[$j][0])) { }
1175 0 16 if (_isNan($pdp_temp[$j])) { }
1180 8 8 if ($cur_val < $cum_val) { }
1191 80 0 if ($pdp_into_cdp_cnt == 0 or _isNan($pdp_temp[$j])) { }
1192 20 60 if ($rrd->{'rra'}[$ii]{'name'} eq 'MAX') { }
20 40 elsif ($rrd->{'rra'}[$ii]{'name'} eq 'MIN') { }
20 20 elsif ($rrd->{'rra'}[$ii]{'name'} eq 'AVERAGE') { }
1202 0 0 if ($rrd->{'rra'}[$ii]{'name'} eq 'AVERAGE') { }
1208 16 64 if (_isNan($pdp_temp[$j])) { }
1214 4 76 if (_isNan($pdp_temp[$j])) { }
1218 19 57 if (_isNan($rrd->{'rra'}[$ii]{'cdp_prep'}[$j][0])) { }
1219 0 19 if ($rrd->{'rra'}[$ii]{'name'} eq 'AVERAGE')
1224 19 38 if ($rrd->{'rra'}[$ii]{'name'} eq 'AVERAGE') { }
19 19 elsif ($rrd->{'rra'}[$ii]{'name'} eq 'MIN') { }
19 0 elsif ($rrd->{'rra'}[$ii]{'name'} eq 'MAX') { }
1227 19 0 if ($pdp_temp[$j] < $rrd->{'rra'}[$ii]{'cdp_prep'}[$j][0])
1231 19 0 if ($pdp_temp[$j] > $rrd->{'rra'}[$ii]{'cdp_prep'}[$j][0])
1243 0 40 if ($elapsed_pdp_st > 1)
1257 30 0 if ($inplace eq 'memory') { }
1271 0 10 if ($inplace eq 'file')
1295 0 1 if ($start < 315360000)
1296 0 1 if ($end < $start)
1297 0 1 if ($step < 1)
1299 0 1 unless ($cf =~ /AVERAGE|MIN|MAX|LAST/)
1308 2 3 if ($rrd->{'rra'}[$i]{'name'} eq $cf)
1312 1 1 if ($step_diff < 0)
1313 1 1 if ($cal_start <= $start) { }
1314 1 0 if ($firstfull or $step_diff < $best_full_step_diff)
1319 1 0 if ($cal_start > $start)
1320 1 0 if ($firstpart or $best_match < $tmp_match and $step_diff < $best_part_step_diff)
1327 1 0 if ($firstfull == 0) { }
0 0 elsif ($firstpart == 0) { }
1335 0 1 unless (defined $rrd->{'dataloaded'})
1346 5 0 if ($t > $start and $t <= $end + $step)
1366 1 0 if (defined $_[1])
1375 0 1 if ($noencoding < 0.5)
1377 0 0 if ($self->{'encoding'} eq 'native-double-simple' or $self->{'encoding'} eq 'native-double-mixed') { }
0 0 elsif ($self->{'encoding'} =~ /double/) { }
1425 4 0 if (defined $args_str)
1433 4 0 $notimecomments > 0 ? :
1436 1 3 unless (defined $rrd->{'dataloaded'})
1440 4 0 if ($noheader < 1)
1446 0 4 if ($timecomments)
1478 0 120 if ($timecomments)
1540 0 60 if ($self->{'encoding'} eq 'native-double-simple' or $self->{'encoding'} eq 'native-double-mixed') { }
0 60 elsif ($self->{'encoding'} eq 'native-single') { }
1574 1 2 unless (defined $self->{'rrd'}{'dataloaded'})
1576 0 3 if (@_ > 1) { }
0 3 elsif (not defined $self->{'file_name'}) { }
1582 0 3 unless CORE::open $self->{'fd'}, '+<', $self->{'file_name'} or CORE::open $self->{'fd'}, '>', $self->{'file_name'}
1586 0 3 unless (defined $self->{'encoding'})
1588 0 3 if (@_ > 2)
1590 0 0 unless ($encoding =~ /^(native-double|native-double-simple|native-double-mixed|portable-double|portable-single)$/)
1591 0 0 if ($encoding =~ /^native-double$/)
1604 0 75 if ($self->{'encoding'} ne $current_encoding)
1623 6 0 if (defined $self->{'fd'})
1640 0 1 if ($last_up < 315360000)
1641 0 1 if ($pdp_step < 1)
1642 0 1 unless ($encoding =~ /^(native-double|native-double-simple|native-double-mixed|portable-double|portable-single)$/)
1643 0 1 if ($encoding =~ /^native-double$/)
1655 4 5 if (do { $args }->[$i] =~ /^DS:([a-zA-Z0-9]+):(GAUGE|COUNTER|DERIVE|ABSOLUTE):([0-9]+):(U|[+|-]?[0-9\.]+):(U|[+|-]?[0-9\.]+)$/) { }
5 0 elsif (do { $args }->[$i] =~ /^RRA:(AVERAGE|MAX|MIN|LAST):([0-9\.]+):([0-9]+):([0-9]+)$/) { }
1657 4 0 if ($min eq 'U')
1658 4 0 if ($max eq 'U')
1666 0 5 if ($4 < 1)
1667 0 5 if ($2 < 0 or $2 > 1)
1668 0 5 if ($3 < 1)
1674 0 1 if ($rrd->{'ds_cnt'} < 1)
1675 0 1 if ($rrd->{'rra_cnt'} < 1)
1701 0 6 unless CORE::open $self->{'fd'}, '<', $self->{'file_name'}
1709 0 6 if ($file_cookie ne 'RRD')
1711 0 6 if ($rrd->{'version'} ne '0003' and $rrd->{'version'} ne '0004')
1729 6 0 if ($PACK_LITTLE_ENDIAN_SUPPORT > 0)
1737 0 6 if ($file_floatcookie_native_double_simple eq $cookie) { }
0 6 elsif ($file_floatcookie_native_double_mixed eq $cookie) { }
1 5 elsif ($file_floatcookie_native_single eq $singlecookie) { }
5 0 elsif ($PACK_LITTLE_ENDIAN_SUPPORT > 0 and $file_floatcookie_littleendian_double eq $cookie) { }
0 0 elsif ($PACK_LITTLE_ENDIAN_SUPPORT > 0 and $file_floatcookie_littleendian_single eq $singlecookie) { }
0 0 elsif ($file_floatcookie_portable_single eq $singlecookie) { }
0 0 elsif ($file_floatcookie_portable_double eq $cookie) { }
1793 0 6 if ($file_len < $correct_len or $file_len > $correct_len + 8)