Branch Coverage

blib/lib/Number/Format.pm
Criterion Covered Total %
branch 181 218 83.0


line true false branch
327 63 264 unless (ref $_[0] and UNIVERSAL::isa($_[0], 'Number::Format'))
344 0 125 unless ref $self
347 0 250 unless defined $$self{"${prefix}thousands_sep"}
349 0 250 if $$self{"${prefix}thousands_sep"} =~ /\d/
351 0 250 if $$self{"${prefix}decimal_point"} =~ /\d/
353 0 250 if $$self{"${prefix}decimal_point"} eq $$self{"${prefix}thousands_sep"}
369 29 7 if (not defined $base or $base == 1024) { }
2 5 elsif ($base == 1000) { }
383 1 4 if $base ** 3 > 9007199254740992
384 3 1 unless $base > 0 and $base == int $base
404 7 1 if vec $bitmask, $offset, 1
445 0 96 if (defined $$locale_values{$_} and $$locale_values{$_} eq '-1')
453 12 312 exists $$locale_values{$arg} ? :
459 1216 40 unless defined $args{$_}
474 0 24 if $$me{"${prefix}decimal_point"} eq $$me{"${prefix}thousands_sep"}
479 0 12 if %args
511 1 120 unless (defined $number)
517 5 116 unless defined $precision
518 0 121 unless defined $precision
520 0 121 unless int $precision == $precision
523 0 121 if (ref $number and $number->isa('Math::BigFloat'))
535 1 120 if $product > 9007199254740992
541 4 116 if $sign < 0
582 2 90 unless (defined $number)
590 55 37 $mon ? :
595 8 84 unless defined $precision
596 89 3 unless defined $trailing_zeroes
600 5 87 if $sign < 0
605 0 91 if ($number =~ /^(-?[\d.]+)e([+-]\d+)$/)
619 78 13 if length $integer < length $number
621 13 78 unless defined $decimal
624 55 36 if $trailing_zeroes and $precision > length $decimal
629 91 0 if ($thousands_sep)
641 8 83 if $integer eq ''
644 83 8 defined $decimal && length $decimal ? :
648 5 86 $sign < 0 ? :
668 1 7 unless (defined $number)
674 8 0 unless defined $format
675 0 8 unless $format =~ /x/
718 1 12 unless (defined $number)
724 0 13 unless defined $picture
737 4 9 if $sign < 0
738 4 9 $sign < 0 ? :
739 4 9 $sign < 0 ? :
744 0 13 unless defined $pic_int
745 3 10 unless defined $pic_dec
747 0 13 if @cruft
765 0 13 unless defined $num_int
766 3 10 unless defined $num_dec
769 2 11 if (length $num_int > $intsize)
772 0 2 unless defined $pic_prefix
785 8 3 if $picture =~ /\Q$$self{'decimal_point'}\E/
792 16 2 if $char eq '#'
801 67 54 if $char eq '#'
802 17 104 if not defined $char or $char eq $$self{'thousands_sep'} and $#num_int < 0
809 0 11 unless defined $sign_prefix
810 3 8 unless defined $pic_prefix
847 1 54 unless (defined $number)
854 52 3 if not defined $curr_symbol or lc $curr_symbol eq 'int_curr_symbol'
856 3 52 if not defined $curr_symbol or lc $curr_symbol eq 'currency_symbol'
858 0 55 unless defined $curr_symbol
861 52 3 $curr_symbol eq $$self{'int_curr_symbol'} ? :
865 48 7 unless defined $precision
866 0 55 unless defined $precision
867 0 55 unless defined $precision
871 41 14 if $sign < 0
879 1 54 unless $decimal
884 41 14 if ($sign < 0) { }
900 54 1 $precision ? :
906 20 35 if ($sep_by_space == 0) { }
23 12 elsif ($sep_by_space == 1) { }
12 0 elsif ($sep_by_space == 2) { }
926 35 20 if ($sign_posn >= 0 and $sign_posn <= 2) { }
20 0 elsif ($sign_posn == 3 or $sign_posn == 4) { }
929 35 0 if ($curr_symbol ne '')
931 26 9 if ($cs_precedes) { }
941 7 28 if ($sign_posn == 0) { }
21 7 elsif ($sign_posn == 1) { }
957 13 7 if ($sign_posn == 3) { }
967 11 9 if ($cs_precedes) { }
1075 1 17 unless (defined $number)
1081 0 18 if $number < 0
1087 0 18 if (@options == 1) { }
1099 14 4 unless defined $options{'precision'}
1101 0 18 unless defined $options{'precision'}
1106 6 12 if ($options{'mode'} =~ /^iec(60027)?$/i) { }
12 0 elsif ($options{'mode'} =~ /^trad(itional)?$/i) { }
1110 0 6 if exists $options{'base'}
1132 16 2 unless defined $options{'unit'}
1138 16 2 if ($unit eq 'A')
1140 2 14 if ($number >= $mult{'giga'}) { }
6 8 elsif ($number >= $mult{'mega'}) { }
3 5 elsif ($number >= $mult{'kilo'}) { }
1161 2 16 if ($unit eq 'G') { }
6 10 elsif ($unit eq 'M') { }
5 5 elsif ($unit eq 'K') { }
0 5 elsif ($unit ne 'N') { }
1225 1 19 unless (defined $formatted)
1232 2 18 unless $formatted =~ /\d/
1240 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'})
1260 0 14 if @cruft
1264 1 13 $formatted =~ /^\D*-/ ? :
1266 2 12 if $formatted =~ /\Q$before_re\E(.+)\Q$after_re\E/
1269 0 14 unless defined $integer
1270 6 8 unless defined $decimal
1276 2 12 if $sign < 0
1279 5 9 if $kp
1280 1 13 if $mp
1281 2 12 if $gp