Branch Coverage

blib/lib/Number/Format.pm
Criterion Covered Total %
branch 162 196 82.6


line true false branch
316 58 252 unless (ref $_[0] and UNIVERSAL::isa($_[0], 'Number::Format'))
333 0 118 unless ref $self
336 0 236 unless defined $$self{"${prefix}thousands_sep"}
338 0 236 if $$self{"${prefix}thousands_sep"} =~ /\d/
340 0 236 if $$self{"${prefix}decimal_point"} =~ /\d/
342 0 236 if $$self{"${prefix}decimal_point"} eq $$self{"${prefix}thousands_sep"}
358 28 7 if (not defined $base or $base == 1024) { }
2 5 elsif ($base == 1000) { }
372 1 4 if $base ** 3 > 9007199254740992
373 3 1 unless $base > 0 and $base == int $base
418 11 286 exists $$locale_values{$arg} ? :
424 1112 38 unless defined $args{$_}
439 0 22 if $$me{"${prefix}decimal_point"} eq $$me{"${prefix}thousands_sep"}
444 0 11 if %args
475 4 110 unless defined $precision
476 0 114 unless defined $precision
477 0 114 unless defined $number
484 1 113 if $product > 9007199254740992
490 4 109 if $sign < 0
532 54 33 $mon ? :
537 5 82 unless defined $precision
538 84 3 unless defined $trailing_zeroes
542 5 82 if $sign < 0
547 0 86 if ($number =~ /^(-?[\d.]+)e([+-]\d+)$/)
561 77 9 if length $integer < length $number
563 9 77 unless defined $decimal
566 54 32 if $trailing_zeroes and $precision > length $decimal
571 86 0 if ($thousands_sep)
583 4 82 if $integer eq ''
586 81 5 defined $decimal && length $decimal ? :
590 5 81 $sign < 0 ? :
609 7 0 unless defined $format
610 0 7 unless $format =~ /x/
663 4 8 if $sign < 0
664 4 8 $sign < 0 ? :
665 4 8 $sign < 0 ? :
670 0 12 unless defined $pic_int
671 2 10 unless defined $pic_dec
673 0 12 if @cruft
691 0 12 unless defined $num_int
692 2 10 unless defined $num_dec
695 2 10 if (length $num_int > $intsize)
698 0 2 unless defined $pic_prefix
711 8 2 if $picture =~ /\Q$$self{'decimal_point'}\E/
718 16 2 if $char eq '#'
727 66 52 if $char eq '#'
728 17 101 if not defined $char or $char eq $$self{'thousands_sep'} and $#num_int < 0
735 0 10 unless defined $sign_prefix
736 2 8 unless defined $pic_prefix
774 51 3 if not defined $curr_symbol or lc $curr_symbol eq 'int_curr_symbol'
776 3 51 if not defined $curr_symbol or lc $curr_symbol eq 'currency_symbol'
778 0 54 unless defined $curr_symbol
781 51 3 $curr_symbol eq $$self{'int_curr_symbol'} ? :
785 47 7 unless defined $precision
786 0 54 unless defined $precision
787 0 54 unless defined $precision
791 41 13 if $sign < 0
799 1 53 unless $decimal
804 41 13 if ($sign < 0) { }
820 53 1 $precision ? :
826 20 34 if ($sep_by_space == 0) { }
22 12 elsif ($sep_by_space == 1) { }
12 0 elsif ($sep_by_space == 2) { }
846 34 20 if ($sign_posn >= 0 and $sign_posn <= 2) { }
20 0 elsif ($sign_posn == 3 or $sign_posn == 4) { }
849 34 0 if ($curr_symbol ne '')
851 25 9 if ($cs_precedes) { }
861 7 27 if ($sign_posn == 0) { }
20 7 elsif ($sign_posn == 1) { }
877 13 7 if ($sign_posn == 3) { }
887 11 9 if ($cs_precedes) { }
995 0 17 if $number < 0
1001 0 17 if (@options == 1) { }
1013 13 4 unless defined $options{'precision'}
1015 0 17 unless defined $options{'precision'}
1020 6 11 if ($options{'mode'} =~ /^iec(60027)?$/i) { }
11 0 elsif ($options{'mode'} =~ /^trad(itional)?$/i) { }
1024 0 6 if exists $options{'base'}
1046 15 2 unless defined $options{'unit'}
1052 15 2 if ($unit eq 'A')
1054 2 13 if ($number >= $mult{'giga'}) { }
6 7 elsif ($number >= $mult{'mega'}) { }
3 4 elsif ($number >= $mult{'kilo'}) { }
1075 2 15 if ($unit eq 'G') { }
6 9 elsif ($unit eq 'M') { }
5 4 elsif ($unit eq 'K') { }
0 4 elsif ($unit ne 'N') { }
1139 1 18 unless $formatted =~ /\d/
1147 0 0 if ($$self{'mon_decimal_point'} and $$self{'decimal_point'} ne $$self{'mon_decimal_point'} and $$self{'decimal_point'} ne $$self{'mon_thousands_sep'} and $$self{'mon_decimal_point'} ne $$self{'thousands_sep'})
1167 0 14 if @cruft
1171 1 13 $formatted =~ /^\D*-/ ? :
1173 2 12 if $formatted =~ /\Q$before_re\E(.+)\Q$after_re\E/
1176 0 14 unless defined $integer
1177 6 8 unless defined $decimal
1183 2 12 if $sign < 0
1186 5 9 if $kp
1187 1 13 if $mp
1188 2 12 if $gp