File Coverage

lib/Perlmazing/Perlmazing/Precompile/numeric.pm
Criterion Covered Total %
statement 3 35 8.5
branch 0 32 0.0
condition 0 18 0.0
subroutine 1 2 50.0
pod n/a
total 4 87 4.6


line stmt bran cond sub pod time code
1 31     31   313 use Perlmazing;
  31         81  
  31         179  
2            
3             sub main ($$) {
4 0     0     my ($aa, $bb) = ($_[0], $_[1]);
5 0 0 0       if (is_number $aa and is_number $bb) {
    0 0        
    0          
    0          
    0          
    0          
6 0           my $r = to_number($aa) <=> to_number($bb);
7 0 0         return $r if $r;
8 0           $aa cmp $bb;
9             } elsif (is_number $aa) {
10 0           -1;
11             } elsif (is_number $bb) {
12 0           1;
13             } elsif (defined($aa) and defined($bb)) {
14 0 0 0       if ($aa =~ /\d/ and $bb =~ /\d/) {
15 0           my @split_a = split /(\d+)/, $aa;
16 0           my @split_b = split /(\d+)/, $bb;
17 0           my $current_sort = 0;
18 0           my $cmp_sort = '';
19 0           while (1) {
20 0           my $break = 1;
21 0 0 0       last unless @split_a and @split_b;
22 0           my ($aa, $bb) = (shift(@split_a), shift(@split_b));
23 0 0 0       if (is_number $aa and is_number $bb) {
    0          
    0          
24 0           $current_sort = $aa <=> $bb;
25 0 0         unless ($current_sort) {
26 0           $current_sort = $aa cmp $bb;
27 0 0         $cmp_sort = $current_sort unless $cmp_sort;
28 0           $break = 0;
29             }
30             } elsif (is_number $aa) {
31 0           $current_sort = -1;
32             } elsif (is_number $bb) {
33 0           $current_sort = 1;
34             } else {
35 0           $current_sort = $aa cmp $bb;
36             }
37 0 0 0       return $current_sort if $current_sort and $break;
38             }
39 0 0         return $cmp_sort if $cmp_sort;
40 0           $current_sort;
41             } else {
42 0           $aa cmp $bb;
43             }
44             } elsif (defined $aa) {
45 0           1;
46             } elsif (defined $bb) {
47 0           -1;
48             } else {
49 0           0;
50             }
51             }
52