line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## no critic: Modules::ProhibitAutomaticExportation |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Test::Sort::Sub; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
6
|
|
|
|
|
|
|
our $DATE = '2020-02-28'; # DATE |
7
|
|
|
|
|
|
|
our $DIST = 'Sort-Sub'; # DIST |
8
|
|
|
|
|
|
|
our $VERSION = '0.118'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
15
|
|
|
15
|
|
1001906
|
use 5.010001; |
|
15
|
|
|
|
|
207
|
|
11
|
15
|
|
|
15
|
|
93
|
use strict 'subs', 'vars'; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
510
|
|
12
|
15
|
|
|
15
|
|
77
|
use warnings; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
464
|
|
13
|
|
|
|
|
|
|
|
14
|
15
|
|
|
15
|
|
75
|
use Exporter 'import'; |
|
15
|
|
|
|
|
26
|
|
|
15
|
|
|
|
|
488
|
|
15
|
15
|
|
|
15
|
|
6855
|
use Sort::Sub (); |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
399
|
|
16
|
15
|
|
|
15
|
|
90
|
use Test::More 0.98; |
|
15
|
|
|
|
|
213
|
|
|
15
|
|
|
|
|
77
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @EXPORT = qw(sort_sub_ok); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _sort { |
21
|
39
|
|
|
39
|
|
109
|
my ($args, $extras, $output_name) = @_; |
22
|
|
|
|
|
|
|
|
23
|
39
|
|
|
|
|
78
|
my $subname = $args->{subname}; |
24
|
39
|
100
|
|
|
|
289
|
Sort::Sub->import("$subname$extras", ($args->{args} ? $args->{args} : ())); |
25
|
39
|
|
|
|
|
59
|
my $res; |
26
|
39
|
100
|
|
|
|
110
|
if ($args->{compares_record}) { |
27
|
24
|
|
|
|
|
42
|
$res = [map {$_->[0]} sort {&{$subname}($a,$b)} |
|
24
|
|
|
|
|
40
|
|
|
24
|
|
|
|
|
48
|
|
28
|
6
|
|
|
|
|
15
|
(map { [$args->{input}[$_], $_] } 0..$#{ $args->{input} })]; |
|
24
|
|
|
|
|
63
|
|
|
6
|
|
|
|
|
16
|
|
29
|
|
|
|
|
|
|
} else { |
30
|
33
|
|
|
|
|
52
|
$res = [sort {&{$subname}($a,$b)} @{ $args->{input} }]; |
|
189
|
|
|
|
|
547
|
|
|
189
|
|
|
|
|
428
|
|
|
33
|
|
|
|
|
132
|
|
31
|
|
|
|
|
|
|
} |
32
|
39
|
50
|
|
|
|
278
|
is_deeply($args->{$output_name}, $res) or diag explain $res; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub sort_sub_ok { |
36
|
16
|
|
|
16
|
1
|
3400
|
my %args = @_; |
37
|
|
|
|
|
|
|
|
38
|
16
|
|
|
|
|
45
|
my $subname = $args{subname}; |
39
|
|
|
|
|
|
|
subtest "sort_sub_ok $subname" => sub { |
40
|
16
|
|
|
16
|
|
16773
|
my $res; |
41
|
|
|
|
|
|
|
|
42
|
16
|
100
|
|
|
|
67
|
if ($args{output}) { |
43
|
15
|
|
|
|
|
56
|
_sort(\%args, '', 'output'); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
16
|
100
|
|
|
|
14959
|
if ($args{output_i}) { |
47
|
10
|
|
|
|
|
36
|
_sort(\%args, '', 'output_i'); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
16
|
100
|
|
|
|
6671
|
if ($args{output_r}) { |
51
|
2
|
|
|
|
|
7
|
_sort(\%args, '', 'output_r'); |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
16
|
100
|
|
|
|
1124
|
if ($args{output_ir}) { |
55
|
12
|
|
|
|
|
41
|
_sort(\%args, '', 'output_ir'); |
56
|
|
|
|
|
|
|
}; |
57
|
16
|
|
|
|
|
138
|
}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
# ABSTRACT: Test Sort::Sub::* subroutine |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |