| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The script tests private Arch::Tree functions used for "annotate". |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
41
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
995
|
use FindBin; |
|
|
1
|
|
|
|
|
1302
|
|
|
|
1
|
|
|
|
|
55
|
|
|
8
|
1
|
|
|
1
|
|
976
|
use lib "$FindBin::Bin/../perllib"; |
|
|
1
|
|
|
|
|
803
|
|
|
|
1
|
|
|
|
|
8
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1351
|
use Test::More tests => 32; |
|
|
1
|
|
|
|
|
21763
|
|
|
|
1
|
|
|
|
|
13
|
|
|
11
|
1
|
|
|
1
|
|
8
|
use_ok("Arch::Tree"); |
|
|
1
|
|
|
|
|
1022
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
10
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
999
|
my (@lines, @line_rd_indexes, $skip_linenums); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
5
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("3-5,8", 9); |
|
18
|
1
|
|
|
|
|
11
|
is_deeply($skip_linenums, {qw(1 1 2 1 6 1 7 1 9 1)}, "skip_linenums 1"); |
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
997
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums([ 3..5, 8 ], 9); |
|
21
|
1
|
|
|
|
|
11
|
is_deeply($skip_linenums, {qw(1 1 2 1 6 1 7 1 9 1)}, "skip_linenums 2"); |
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
855
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums({ 3 => 1, 4 => 1, 5 => 1, 8 => 1 }, 9); |
|
24
|
1
|
|
|
|
|
11
|
is_deeply($skip_linenums, {qw(1 1 2 1 6 1 7 1 9 1)}, "skip_linenums 3"); |
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
771
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("3-5,8", 8); |
|
27
|
1
|
|
|
|
|
9
|
is_deeply($skip_linenums, {qw(1 1 2 1 6 1 7 1)}, "skip_linenums 4"); |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
767
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("1,2,3,4", 4); |
|
30
|
1
|
|
|
|
|
6
|
is_deeply($skip_linenums, {qw()}, "skip_linenums 5"); |
|
31
|
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
910
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("", 5); |
|
33
|
1
|
|
|
|
|
8
|
is_deeply($skip_linenums, {qw(1 1 2 1 3 1 4 1 5 1)}, "skip_linenums 6"); |
|
34
|
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
783
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums([], 5); |
|
36
|
1
|
|
|
|
|
9
|
is_deeply($skip_linenums, {qw(1 1 2 1 3 1 4 1 5 1)}, "skip_linenums 7"); |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
808
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums({}, 5); |
|
39
|
1
|
|
|
|
|
10
|
is_deeply($skip_linenums, {qw(1 1 2 1 3 1 4 1 5 1)}, "skip_linenums 8"); |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
766
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums(undef, 8); |
|
42
|
1
|
|
|
|
|
5
|
is_deeply($skip_linenums, {qw()}, "skip_linenums 9"); |
|
43
|
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
740
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("0-10", 5); |
|
45
|
1
|
|
|
|
|
5
|
is_deeply($skip_linenums, {qw()}, "skip_linenums 10"); |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
864
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("-0", 5); |
|
48
|
1
|
|
|
|
|
5
|
is_deeply($skip_linenums, {qw()}, "skip_linenums 11"); |
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
842
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("-1,2-2,4-", 5); |
|
51
|
1
|
|
|
|
|
7
|
is_deeply($skip_linenums, {qw(3 1)}, "skip_linenums 12"); |
|
52
|
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
836
|
$skip_linenums = Arch::Tree::_get_skip_hash_from_linenums("-1,9-", 5); |
|
54
|
1
|
|
|
|
|
8
|
is_deeply($skip_linenums, {qw(2 1 3 1 4 1 5 1)}, "skip_linenums 13"); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
|
57
|
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
781
|
ok(Arch::Tree::_eq(undef, undef), "eq 1"); |
|
59
|
1
|
|
|
|
|
539
|
ok(Arch::Tree::_eq(-1, -1), "eq 2"); |
|
60
|
1
|
|
|
|
|
533
|
ok(Arch::Tree::_eq(5, 5), "eq 3"); |
|
61
|
1
|
|
|
|
|
503
|
ok(!Arch::Tree::_eq(undef, 0), "eq 4"); |
|
62
|
1
|
|
|
|
|
501
|
ok(!Arch::Tree::_eq(0, undef), "eq 5"); |
|
63
|
1
|
|
|
|
|
7315
|
ok(!Arch::Tree::_eq(1, -1), "eq 6"); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------- |
|
66
|
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
507
|
@lines = qw(line1 line2 line3 line4 line5 line6 line7); |
|
68
|
1
|
|
|
|
|
4
|
@line_rd_indexes = (4, 4, 2, 1, 1, 1, 2); |
|
69
|
1
|
|
|
|
|
7
|
Arch::Tree::_group_annotated_lines(\@lines, \@line_rd_indexes); |
|
70
|
1
|
|
|
|
|
11
|
is_deeply(\@lines, [[qw(line1 line2)], [qw(line3)], [qw(line4 line5 line6)], [qw(line7)]], "lines 1"); |
|
71
|
1
|
|
|
|
|
1630
|
is_deeply(\@line_rd_indexes, [4, 2, 1, 2], "line_rd_indexes 1"); |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
979
|
@lines = qw(); |
|
74
|
1
|
|
|
|
|
4
|
@line_rd_indexes = (); |
|
75
|
1
|
|
|
|
|
4
|
Arch::Tree::_group_annotated_lines(\@lines, \@line_rd_indexes); |
|
76
|
1
|
|
|
|
|
6
|
is_deeply(\@lines, [], "lines 2"); |
|
77
|
1
|
|
|
|
|
741
|
is_deeply(\@line_rd_indexes, [], "line_rd_indexes 2"); |
|
78
|
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
769
|
@lines = qw(line1); |
|
80
|
1
|
|
|
|
|
110
|
@line_rd_indexes = (1); |
|
81
|
1
|
|
|
|
|
5
|
Arch::Tree::_group_annotated_lines(\@lines, \@line_rd_indexes); |
|
82
|
1
|
|
|
|
|
7
|
is_deeply(\@lines, [[qw(line1)]], "lines 3"); |
|
83
|
1
|
|
|
|
|
918
|
is_deeply(\@line_rd_indexes, [1], "line_rd_indexes 3"); |
|
84
|
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
741
|
@lines = qw(line1 line1); |
|
86
|
1
|
|
|
|
|
3
|
@line_rd_indexes = (0, 0); |
|
87
|
1
|
|
|
|
|
5
|
Arch::Tree::_group_annotated_lines(\@lines, \@line_rd_indexes); |
|
88
|
1
|
|
|
|
|
6
|
is_deeply(\@lines, [[qw(line1 line1)]], "lines 4"); |
|
89
|
1
|
|
|
|
|
1001
|
is_deeply(\@line_rd_indexes, [0], "line_rd_indexes 4"); |
|
90
|
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
807
|
@lines = qw(line1 line2 line3 line4 line5 line6); |
|
92
|
1
|
|
|
|
|
4
|
@line_rd_indexes = (5, 4, 3, 2, 1, 0); |
|
93
|
1
|
|
|
|
|
6
|
Arch::Tree::_group_annotated_lines(\@lines, \@line_rd_indexes); |
|
94
|
1
|
|
|
|
|
8
|
is_deeply(\@lines, [[qw(line1)], [qw(line2)], [qw(line3)], [qw(line4)], [qw(line5)], [qw(line6)]], "lines 5"); |
|
95
|
1
|
|
|
|
|
1805
|
is_deeply(\@line_rd_indexes, [5, 4, 3, 2, 1, 0], "line_rd_indexes 5"); |
|
96
|
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
908
|
@lines = qw(line1 line2 line3 line4 line5 line6); |
|
98
|
1
|
|
|
|
|
5
|
@line_rd_indexes = (undef, undef, 1, 1, undef, undef); |
|
99
|
1
|
|
|
|
|
4
|
Arch::Tree::_group_annotated_lines(\@lines, \@line_rd_indexes); |
|
100
|
1
|
|
|
|
|
11
|
is_deeply(\@lines, [[qw(line1 line2)], [qw(line3 line4)], [qw(line5 line6)]], "lines 6"); |
|
101
|
1
|
|
|
|
|
1337
|
is_deeply(\@line_rd_indexes, [undef, 1, undef], "line_rd_indexes 6"); |
|
102
|
|
|
|
|
|
|
|