Branch Coverage

blib/lib/Spreadsheet/Reader/Format/ParseExcelFormatStrings.pm
Criterion Covered Total %
branch 331 420 78.8


line true false branch
131 0 38 unless (defined $coercion_string)
138 0 38 unless ($coercion)
154 0 105 unless (defined $format_strings)
166 105 0 if ($self->get_cache_behavior)
171 6 99 if ($self->_has_cached_format($cache_key)) { }
184 9 90 $format_string_list[-1] =~ /^[A-Za-z\@\s\"]*$/ ? :
189 90 9 unless $last_is_text
190 17 82 if (scalar @format_string_list == 2 + $last_is_text) { }
70 12 elsif (scalar @format_string_list == 1 + $last_is_text) { }
4 8 elsif (scalar @format_string_list == 0 + $last_is_text) { }
248 195 264 if ($fixed_value)
249 4 191 if ($fixed_value =~ /\[\$([^\-\]]*)\-?\d*\]/) { }
8 183 elsif ($fixed_value =~ /\[[^hms]*\]/) { }
4 354 elsif ($fixed_value =~ /\"\-\"/ and $format_string) { }
261 324 135 if (defined $pre_action) { }
262 16 0 $text ? :
220 16 defined $number ? :
88 236 $date ? :
266 88 236 if $date
270 33 194 if ($action_type and $current_action and $current_action ne $action_type and $action_type ne 'TEXT')
275 8 25 if ($action_type eq 'DATE') { }
0 25 elsif ($action_type eq 'NUMBER') { }
25 0 elsif ($action_type eq 'INTEGER' or $action_type eq 'DECIMAL') { }
279 4 4 if ($current_action eq 'NUMBER') { }
4 0 elsif ($pre_action eq '@') { }
282 4 0 if ($pre_action =~ /^\.$/ and $format_string =~ /^0+/ or $pre_action =~ /^0+$/ and $deconstructed_list[-1][0] =~ /^\.$/)
296 0 0 if ($current_action eq 'TEXT')
304 25 0 if ($current_action eq 'NUMBER')
310 0 33 if ($fail)
314 324 0 if $current_action
323 9 126 if $quote_string and $fixed_value eq $quote_string
326 2 457 if ($x++ == 30)
334 143 314 if length $format_string == 0
338 0 143 if $format_string
341 88 55 $action_type =~ /^(NUMBER|SCIENTIFIC|INTEGER|PERCENT|FRACTION|DECIMAL)$/ ? :
343 21 122 $action_type && $action_type eq 'TEXT' ? :
344 4 139 if ($action_type and $action_type eq 'DATESTRING')
349 4 0 if $last_deconstructed_list
360 122 21 $intermediate_action =~ /^(NUMBER|SCIENTIFIC|INTEGER|PERCENT|FRACTION|DECIMAL|DATE|DATESTRING)$/ ? :
363 26 71 if ($is_date and not $date_text)
366 26 0 $intermediate_action =~ /^(NUMBER|SCIENTIFIC|INTEGER|PERCENT|FRACTION|DECIMAL|DATE|DATESTRING)$/ ? :
377 37 60 if $coercion_name
392 97 0 if ($self->get_cache_behavior)
436 12 13 if (not $found_string and defined $piece->[0])
442 13 12 if ($piece->[1])
456 12 9 if ($found_string) { }
488 30 0 $self->get_epoch_year == 1904 ? :
494 0 172 unless (defined $num)
506 12 160 if ($clone_ref->{'is_duration'}) { }
508 0 12 if ($self->get_date_behavior)
512 0 12 $sign == -1 ? :
520 4 156 if ($self->get_date_behavior)
525 12 144 if ($clone_ref->{'sub_seconds'})
529 10 2 if ("0.$calc_sub_secs" >= 0.5)
537 156 0 if ($clone_ref->{'cldr_string'}) { }
543 12 144 if ($clone_ref->{'sub_seconds'} and $clone_ref->{'sub_seconds'} ne '1')
546 0 156 if $clone_ref->{'format_remainder'}
571 0 46 unless ($date)
580 28 18 if ($date =~ /(.*:\d+)\.(\d+)(.*)/)
585 28 0 if $3
596 2 0 unless ($dt_us or $dt_eu)
602 0 2 $century_postfix + 20 > 99 ? :
603 2 0 $century_postfix - 79 < 0 ? :
605 2 0 if (defined $1 and defined $2 and defined $3)
609 0 2 defined $drop_year && $year >= $drop_year ? :
0 2 defined $bump_year && $year <= $bump_year ? :
618 38 0 $dt_us ? :
8 38 $self->get_european_first && $dt_eu ? :
623 46 0 if ($dt) { }
624 28 18 if $calc_sub_secs
633 2 44 if ($clone_ref->{'is_duration'}) { }
634 2 0 $self->get_epoch_year == 1904 ? :
637 0 2 if ($self->get_date_behavior)
641 2 0 $sign == -1 ? :
652 0 44 if ($self->get_date_behavior)
655 2 42 if ($clone_ref->{'sub_seconds'})
659 0 2 if ("0.$calc_sub_secs" >= 0.5)
665 44 0 if ($clone_ref->{'cldr_string'}) { }
673 2 42 if ($clone_ref->{'sub_seconds'} and $clone_ref->{'sub_seconds'} ne '1')
676 0 44 if $clone_ref->{'format_remainder'}
702 184 8 if (defined $piece->[0])
705 4 180 if ($piece->[0] =~ /\[(.+)\]/) { }
8 172 elsif (ref $is_duration eq 'ARRAY') { }
60 112 elsif ($piece->[0] =~ /m/) { }
20 92 elsif ($piece->[0] =~ /h/) { }
8 84 elsif ($piece->[0] =~ m[AM?/PM?]i) { }
4 80 elsif ($piece->[0] =~ /d{3,5}/) { }
4 76 elsif (not $sub_seconds and $piece->[0] =~ /[\.]/) { }
4 72 elsif ($sub_seconds eq '1') { }
710 4 0 if ($is_duration->[0] =~ /[hms]/) { }
723 0 8 if ($piece->[0] eq '.') { }
8 0 elsif ($piece->[0] =~ /$next_duration/) { }
730 4 4 if $piece->[1]
733 0 8 if ($piece->[0] =~ /^0+$/)
749 28 32 if ($cldr_string and $cldr_string =~ /:'?$/ or $piece->[1] and $piece->[1] eq ':') { }
775 4 0 if ($piece->[0] =~ /^0+$/) { }
785 4 180 if ($sub_seconds and $sub_seconds ne '1') { }
791 108 84 if ($piece->[1])
792 0 108 if ($sub_seconds and $sub_seconds ne '1') { }
823 0 42 if ($key eq '0')
829 14 28 if ($key eq 's')
830 0 14 $first ? :
838 14 28 if ($key eq 'm')
841 0 14 $first ? :
850 14 28 if ($key eq 'h')
853 14 0 $first ? :
862 28 14 if $duration_ref->[2][$position]
878 0 0 if ($type_filter->name eq 'ZeroOrUndef' and not $list_ref->[-1][0] and $list_ref->[-1][1] eq '"-"')
891 1 87 if ($list_ref->[-1][0] =~ /(.*[\d\#])\-$/)
901 216 57 if (defined $piece->[0])
902 170 46 if (my(@result) = $piece->[0] =~ /^([0-9#\?]+)([,\-\_])?([#0\?]+)?(,+)?$/) { }
46 0 elsif ($piece->[0] =~ /^((\.)|([Ee][+\-])|(%))$/) { }
905 56 114 $2 ? :
56 114 defined $3 ? :
907 56 114 $3 ? :
908 0 0 $2 && $2 ne ',' ? :
0 170 $4 ? :
909 64 106 if $1 =~ /^([0-9]+)$/
911 110 60 if ($comma_less =~ /^[\#\?]*(0+)$/)
914 52 118 if ($comma_less =~ /^(0+)[\#\?]*$/)
917 0 170 if $divide_by_thousands
926 88 82 if (not $number_type) { }
56 26 elsif ($number_type eq 'INTEGER' or $number_type eq 'DECIMAL') { }
26 0 elsif ($number_type eq 'SCIENTIFIC' or $number_type eq 'FRACTION') { }
928 0 88 if $leading_zeros and length $leading_zeros
930 56 32 if ($comma)
933 32 56 if (defined $piece->[1])
934 20 12 if ($piece->[1] =~ /(\s+)/) { }
0 12 elsif ($piece->[1] eq '/') { }
938 0 0 if $leading_zeros and length $leading_zeros
943 20 36 if ($piece->[1] and $piece->[1] eq '/') { }
947 34 2 if $trailinq_zeros and length $trailinq_zeros
951 2 24 if $leading_zeros and length $leading_zeros
953 14 12 if ($divisor)
960 36 10 if ($2) { }
6 4 elsif ($3) { }
978 25 63 if ($type_filter->name eq 'NegativeNum')
1008 28 28 if (not $found_integer and defined $piece->[0])
1012 36 20 if ($piece->[1])
1027 0 112 if (not defined $adjusted_input or $adjusted_input eq '')
1044 12 100 if $built_ref->{'sign'} and $return
1067 90 29 if (defined $piece->[0])
1068 30 60 if ($piece->[0] eq '.') { }
1074 37 82 if ($piece->[1])
1088 0 114 if (not defined $adjusted_input or $adjusted_input eq '')
1106 12 102 if $built_ref->{'sign'} and $return
1130 12 0 if (defined $piece->[0])
1131 4 8 if ($piece->[0] eq '%') { }
2 6 elsif ($piece->[0] eq '.') { }
1140 0 12 if ($piece->[1])
1144 2 2 if $decimal_count < 2
1155 0 28 if (not defined $adjusted_input or $adjusted_input eq '')
1169 14 14 if ($decimal_count < 2) { }
1181 4 24 if $built_ref->{'sign'} and $return
1201 4 2 exists $conversion_defs->{'decimal'} ? :
1205 26 0 if (defined $piece->[0])
1206 6 20 if ($piece->[0] =~ /(E)(.)/) { }
4 16 elsif ($piece->[0] eq '.') { }
6 10 elsif ($exponent_sprintf) { }
1209 6 0 if $2 eq '+'
1210 2 4 if (exists $conversion_defs->{'exponent'}{'leading_zeros'})
1223 0 26 if ($piece->[1])
1234 0 48 if (not defined $adjusted_input or $adjusted_input eq '') { }
48 0 elsif ($adjusted_input =~ /^\-?\d*(\.\d+)?$/ or $adjusted_input =~ /^(\-)?((\d{1,3})?(\.\d+)?)[Ee](\-)?(\d+)$/ and $2 and $6 and $6 < 309) { }
1252 16 32 if ($built_ref->{'no_decimal'}) { }
1266 24 24 if $built_ref->{'sign'} and $return
1297 0 460 if (not defined $adjusted_input or $adjusted_input eq '')
1311 298 162 if ($built_ref->{'integer'}{'value'})
1313 234 64 if ($built_ref->{'fraction'}{'value'})
1317 332 128 if ($built_ref->{'fraction'}{'value'})
1320 64 0 if (not $return and $built_ref->{'initial_value'})
1323 190 270 if $built_ref->{'sign'} and $return
1354 73 689 if ($value_definitions->{'negative_type'} and $value_definitions->{'initial_value'} < 0)
1368 0 226 if ($value_definitions->{'initial_value'} and $value_definitions->{'divide_by_thousands'})
1400 272 490 if ($value_definitions->{'initial_value'} < 0)
1421 36 12 if (defined $value_definitions->{'integer'}{'value'} and sprintf('%.0f', $value_definitions->{'integer'}{'value'}) =~ /([1-9])/) { }
12 0 elsif ($value_definitions->{'decimal'}{'value'}) { }
1427 12 0 if ($value_definitions->{'decimal'}{'value'} =~ /E(-?\d+)$/i) { }
0 0 elsif ($value_definitions->{'decimal'}{'value'} =~ /([1-9])/) { }
1443 12 36 if ($exponent < 0) { }
22 14 elsif ($exponent > 0) { }
1476 142 160 if ($value_definitions->{'no_decimal'}) { }
160 0 elsif ($value_definitions->{'decimal'}{'max_length'}) { }
1477 34 108 if ($value_definitions->{'decimal'}{'value'} > 0.4998)
1487 70 90 if ($value_definitions->{'decimal'}{'value'})
1493 0 70 if ($round_decimal >= 1)
1504 92 68 unless ($value_definitions->{'decimal'}{'value'})
1520 214 548 if (exists $value_definitions->{'integer'}{'comma'})
1539 16 32 if ($value_definitions->{'exponent'}{'leading_zeros'})
1555 460 0 if ($value_definitions->{'decimal'}{'value'})
1563 276 184 $value_definitions->{'fraction'}{'divisor'} ? :
1567 46 414 if ($value_definitions->{'fraction'}{'value'} eq '1')
1588 154 122 if ($low_delta < $high_delta) { }
1590 88 66 if $return
1593 34 88 if ($high_numerator == $divisor) { }
1599 176 100 if $add_denominator
1614 214 0 if (&is_Int($int)) { }
1640 0 184 unless &is_Num($decimal)
1647 136 288 if ($integer > 999 or $decimal < 1e-05 and $decimal > 1e-10)
1651 120 16 if ($integer <= 999)
1664 40 144 if (not $numerator or $denominator and length $denominator > $max_digits)
1671 6 34 $start_decimal >= 0.5 ? :
1686 30 2292 if ($fixed_list[0]{'delta'} < $lowest->{'delta'})
1702 16 168 if (not $numerator) { }
12 156 elsif (not $denominator or $denominator == 1) { }
1760 0 224 if ($m < 0)
1765 44 180 if $m == 1
1770 224 0 if (wantarray) { }
1773 0 0 $m ? :
1787 464 448 if (wantarray) { }