The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Reading database from ...


------------------------------------------ ------ ------ ------ ------ ------
File                                         stmt   bran   cond    sub  total
------------------------------------------ ------ ------ ------ ------ ------
tests/sort                                   96.0    n/a    n/a   85.7   93.8
Total                                        96.0    n/a    n/a   85.7   93.8
------------------------------------------ ------ ------ ------ ------ ------


Run: ...
Perl version: ...
OS: ...
Start: ...
Finish: ...

tests/sort

line  err   stmt   bran   cond    sub   code
1                                       #!/usr/bin/perl -w
2                                       
3              1                    1   use strict;
               1                        
               1                        
4                                       
5              1                        my %sort =
6                                       (
7                                           B => \&backwards,
8                                           F => \&forwards
9                                       );
10                                      
11                                      sub backwards
12                                      {
13             6                    6       return $b cmp $a;
14                                      }
15                                      
16                                      sub forwards
17                                      {
18    ***      0                    0       return $a cmp $b;
19                                      }
20                                      
21                                      sub GetAlgorithm
22                                      {
23             1                    1       my ($alg) = @_;
24             1                            return $sort{$alg};
25                                      }
26                                      
27             1                        my @list = qw( a d e c g );
28                                      
29                                      # my $alg = GetAlgorithm(('B', 'F')[int(rand(2))]);
30             1                        my $alg = GetAlgorithm(('B', 'F')[0]);
31                                      
32             1                        @list = sort {&{$alg}} @list;
               6                        
               6                        
33                                      
34             1                    1   use Data::Dumper;
               1                        
               1                        
35                                      
36             1                        print STDERR Dumper(\@list);
37                                      
38                                      package Failure;
39                                      
40                                      sub fail
41                                      {
42             1                    1       my @x = 1 .. 5;
43             1                            my @y = sort { Failure->xyz( $a, $b ) } @x;
               8                        
44                                      }
45                                      
46                                      sub xyz
47                                      {
48             8                    8       my $self = shift;
49             8                            my ($a, $b) = @_;
50             8                            $a <=> $b;
51                                      }
52                                      package main;
53                                      
54             1                        my @l = Failure->fail;
55                                      
56             1                        print STDERR Dumper(\@l);


Covered Subroutines
-------------------

Subroutine   Count Location     
------------ ----- -------------
BEGIN            1 tests/sort:3 
BEGIN            1 tests/sort:34
GetAlgorithm     1 tests/sort:23
backwards        6 tests/sort:13
fail             1 tests/sort:42
xyz              8 tests/sort:48

Uncovered Subroutines
---------------------

Subroutine   Count Location     
------------ ----- -------------
forwards         0 tests/sort:18