/
cond_or.5.009005
166 lines (143 loc) · 6.57 KB
/
cond_or.5.009005
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Reading database from /home/pjcj/g/perl/svk/dc/cover_db
------------------------------------------ ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------------------------------ ------ ------ ------ ------ ------
tests/cond_or 95.3 50.0 71.1 66.7 79.2
Total 95.3 50.0 71.1 66.7 79.2
------------------------------------------ ------ ------ ------ ------ ------
Run: ...
Perl version: ...
OS: ...
Start: ...
Finish: ...
tests/cond_or
line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 # Copyright 2002-2007, Paul Johnson (pjcj@cpan.org)
4
5 # This software is free. It is licensed under the same terms as Perl itself.
6
7 # The latest version of this software should be available from my homepage:
8 # http://www.pjcj.net
9
10 1 1 use strict;
1
1
11 1 1 use warnings;
1
1
12
13 1 my @x;
14
15 1 my $y = 1;
16 1 my $z = 0;
17 1 $::foo = 17;
18
19 1 for (0 .. 10)
20 {
21 *** 11 50 $y ||
22 $x[1]++;
23
24 *** 11 50 33 $y ||
25 $x[0]++ ||
26 $x[1]++;
27
28 *** 11 50 $x[2]++
29 unless $z;
30
31 11 for (0 .. 2)
32 {
33 33 $x[3]++;
34 }
35
36 *** 11 50 if ($z)
37 {
38 *** 0 $x[4]++;
39 }
40 else
41 {
42 11 $x[5]++;
43 }
44
45 *** 11 33 my $p = $y || $z;
46 *** 11 33 my $q = $z || $y;
47 11 100 my $r = $_ || "qqq";
48 11 100 my $s = $_ || [];
49 11 my $t = $y | $z;
50 *** 11 50 my $u = $y || 0;
51 *** 11 50 my $v = $y || undef;
52 *** 11 50 my $w = $z || 0;
53
54 *** 11 50 $p ||= $y;
55 *** 11 50 $p ||= $z;
56 11 100 $x[ 6] ||= $y;
57 *** 11 50 $x[ 7] ||= $z;
58 11 100 $x[ 8] ||= 1;
59 11 100 $x[ 9] ||= {};
60 11 100 $x[10] ||= \"foo";
61 11 100 $x[11] ||= \$y;
62 11 100 $x[12] ||= \*STDIO;
63 *** 11 100 0 $x[13] ||= sub { 1 };
*** 0
64 11 100 $x[14] ||= *::foo{SCALAR};
65 *** 11 50 $x[15] ||= *STDIO{IO};
66 11 100 $x[16] ||= bless {}, "XXX";
67 *** 11 50 if ($] >= 5.009)
68 {
69 11 eval '$x[17] //= 0';
70 }
71 }
72
73 # print join(", ", @x), "\n";
Branches
--------
line err % true false branch
----- --- ------ ------ ------ ------
21 *** 50 0 11 unless $y
24 *** 50 0 11 unless $y or $x[0]++
28 *** 50 11 0 unless $z
36 *** 50 0 11 if ($z) { }
67 *** 50 11 0 if ($] >= 5.009)
Conditions
----------
or 2 conditions
line err % l !l expr
----- --- ------ ------ ------ ----
47 100 10 1 $_ || 'qqq'
48 100 10 1 $_ || []
50 *** 50 11 0 $y || 0
51 *** 50 11 0 $y || undef
52 *** 50 0 11 $z || 0
54 *** 50 11 0 $p ||= $y
55 *** 50 11 0 $p ||= $z
56 100 10 1 $x[6] ||= $y
57 *** 50 0 11 $x[7] ||= $z
58 100 10 1 $x[8] ||= 1
59 100 10 1 $x[9] ||= {}
60 100 10 1 $x[10] ||= \'foo'
61 100 10 1 $x[11] ||= \$y
62 100 10 1 $x[12] ||= \*STDIO
63 100 10 1 $x[13] ||= sub {
1;
}
64 100 10 1 $x[14] ||= *foo{'SCALAR'}
65 *** 50 0 11 $x[15] ||= *STDIO{'IO'}
66 100 10 1 $x[16] ||= bless({}, 'XXX')
or 3 conditions
line err % l !l&&r !l&&!r expr
----- --- ------ ------ ------ ------ ----
24 *** 33 11 0 0 $y or $x[0]++
45 *** 33 11 0 0 $y || $z
46 *** 33 0 11 0 $z || $y
Covered Subroutines
-------------------
Subroutine Count Location
---------- ----- ----------------
BEGIN 1 tests/cond_or:10
BEGIN 1 tests/cond_or:11
Uncovered Subroutines
---------------------
Subroutine Count Location
---------- ----- ----------------
__ANON__ 0 tests/cond_or:63