File Coverage

lib/Perlmazing/Perlmazing/Precompile/is_number.pm
Criterion Covered Total %
statement 9 16 56.2
branch 0 8 0.0
condition n/a
subroutine 3 4 75.0
pod n/a
total 12 28 42.8


line stmt bran cond sub pod time code
1 34     34   334 use Perlmazing qw(define not_empty);
  34         75  
  34         243  
2 34     34   244 use Scalar::Util qw(looks_like_number);
  34         113  
  34         3825  
3              
4             sub main ($) {
5 0     0     my $i = shift;
6 34     34   263 no warnings;
  34         87  
  34         10790  
7 0 0         return 0 unless not_empty($i);
8 0 0         return 0 if $i =~ /[;:\s\n&=\$%\@\(\)\*]/;
9 0 0         return 0 if $i =~ /[^e][\+\-]/;
10 0 0         return 1 if $i =~ /^0x\d+$/i; # Not detected by Scalar::Util
11 0           $i =~ s/(\d)_(\d)/$1$2/g; # Also not accepted by Scalar::Util
12 0           define looks_like_number $i;;
13             }
14