Branch Coverage

blib/lib/Number/Format.pm
Criterion Covered Total %
branch 187 224 83.4


line true false branch
321 70 272 unless (ref $_[0] and UNIVERSAL::isa($_[0], "Number::Format"))
338 0 132 unless ref $self
342 0 264 unless defined $$self{"${prefix}thousands_sep"}
344 0 264 if $$self{"${prefix}thousands_sep"} =~ /\d/
346 0 264 if $$self{"${prefix}decimal_point"} =~ /\d/
354 0 0 if $$self{"${prefix}decimal_point"} eq $$self{"${prefix}thousands_sep"} and $prefix eq '' || $self->{'mon_decimal_point'} ne ''
367 34 9 if (not defined $base or $base == 1024) { }
4 5 elsif ($base == 1000) { }
385 1 4 if $base ** 3 > "9.00719925474099e+15"
386 3 1 unless $base > 0 and $base == int $base
407 7 1 if vec $bitmask, $offset, 1
441 84 12 if (defined $locale_values->{$_} and $locale_values->{$_} eq -1)
451 24 324 exists $locale_values->{$arg} && $locale_values->{$arg} ne '' ? :
456 1312 40 unless defined $args{$_}
472 0 24 if $$me{"${prefix}decimal_point"} eq $$me{"${prefix}thousands_sep"}
475 0 12 if %args
509 1 124 unless (defined $number)
515 5 120 unless defined $precision
516 0 125 unless defined $precision
518 0 125 unless int $precision == $precision
521 0 125 if (ref $number and $number->isa("Math::BigFloat"))
533 1 124 if $product > "9.00719925474099e+15"
539 4 120 if $sign < 0
582 2 94 unless (defined $number)
592 55 41 $mon ? :
595 8 88 unless defined $precision
596 93 3 unless defined $trailing_zeroes
600 5 91 if $sign < 0
605 0 95 if ($number =~ /^(-?[\d.]+)e([+-]\d+)$/)
619 82 13 if length $integer < length $number
621 13 82 unless defined $decimal
624 55 40 if $trailing_zeroes and $precision > length $decimal
629 95 0 if ($thousands_sep)
641 9 86 if $integer eq ""
644 87 8 defined $decimal && length $decimal ? :
648 5 90 $sign < 0 ? :
670 1 7 unless (defined $number)
676 8 0 unless defined $format
677 0 8 unless $format =~ /x/
722 1 12 unless (defined $number)
728 0 13 unless defined $picture
741 4 9 if $sign < 0
742 4 9 $sign < 0 ? :
743 4 9 $sign < 0 ? :
748 0 13 unless defined $pic_int
749 3 10 unless defined $pic_dec
751 0 13 if @cruft
769 0 13 unless defined $num_int
770 3 10 unless defined $num_dec
773 2 11 if (length $num_int > $intsize)
776 0 2 unless defined $pic_prefix
790 8 3 if $picture =~ /\Q$self->{'decimal_point'}\E/
796 16 2 if $char eq "#"
805 67 54 if $char eq "#"
807 17 104 if not defined $char or $char eq $self->{'thousands_sep'} and $#num_int < 0
813 0 11 unless defined $sign_prefix
814 3 8 unless defined $pic_prefix
853 1 54 unless (defined $number)
861 52 3 if not defined $curr_symbol or lc $curr_symbol eq "int_curr_symbol"
863 3 52 if not defined $curr_symbol or lc $curr_symbol eq "currency_symbol"
864 0 55 unless defined $curr_symbol
868 52 3 $curr_symbol eq $self->{'int_curr_symbol'} ? :
871 48 7 unless defined $precision
872 0 55 unless defined $precision
873 0 55 unless defined $precision
877 41 14 if $sign < 0
885 1 54 unless $decimal
890 41 14 if ($sign < 0) { }
907 54 1 $precision ? :
912 20 35 if ($sep_by_space == 0) { }
23 12 elsif ($sep_by_space == 1) { }
12 0 elsif ($sep_by_space == 2) { }
932 35 20 if ($sign_posn >= 0 and $sign_posn <= 2) { }
20 0 elsif ($sign_posn == 3 or $sign_posn == 4) { }
935 35 0 if ($curr_symbol ne "")
937 26 9 if ($cs_precedes) { }
947 7 28 if ($sign_posn == 0) { }
21 7 elsif ($sign_posn == 1) { }
963 13 7 if ($sign_posn == 3) { }
973 11 9 if ($cs_precedes) { }
1083 1 21 unless (defined $number)
1089 0 22 if $number < 0
1095 0 22 if (@options == 1) { }
1108 18 4 unless defined $options{'precision'}
1110 0 22 unless defined $options{'precision'}
1114 8 14 if ($options{'mode'} =~ /^iec(60027)?$/i) { }
14 0 elsif ($options{'mode'} =~ /^trad(itional)?$/i) { }
1119 0 8 if exists $options{'base'}
1140 19 3 unless defined $options{'unit'}
1145 19 3 if ($unit eq "A")
1147 3 16 if ($number >= $mult{'tera'}) { }
2 14 elsif ($number >= $mult{'giga'}) { }
6 8 elsif ($number >= $mult{'mega'}) { }
3 5 elsif ($number >= $mult{'kilo'}) { }
1172 4 18 if ($unit eq 'T') { }
2 16 elsif ($unit eq 'G') { }
6 10 elsif ($unit eq 'M') { }
5 5 elsif ($unit eq 'K') { }
0 5 elsif ($unit ne 'N') { }
1242 1 22 unless (defined $formatted)
1249 2 21 unless $formatted =~ /\d/
1257 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'})
1279 0 17 if @cruft
1283 1 16 $formatted =~ /^\D*-/ ? :
1285 2 15 if $formatted =~ /\Q$before_re\E(.+)\Q$after_re\E/
1288 0 17 unless defined $integer
1289 9 8 unless defined $decimal
1295 2 15 if $sign < 0
1298 5 12 if $kp
1299 1 16 if $mp
1300 2 15 if $gp
1301 3 14 if $tp