-
Notifications
You must be signed in to change notification settings - Fork 88
/
cond_and.5.008
128 lines (108 loc) · 4.74 KB
/
cond_and.5.008
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
Reading database from ...
------------------------------------------ ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------------------------------ ------ ------ ------ ------ ------
tests/cond_and 96.3 50.0 55.6 100.0 78.4
Total 96.3 50.0 55.6 100.0 78.4
------------------------------------------ ------ ------ ------ ------ ------
Run: ...
Perl version: ...
OS: ...
Start: ...
Finish: ...
tests/cond_and
line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 # Copyright 2002-2011, 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
18 1 for (0 .. 10)
11
19 {
20 *** 11 50 $y &&
21 $x[1]++;
22
23 *** 11 100 66 $y &&
24 $x[0]++ &&
25 $x[1]++;
26
27 *** 11 50 $x[2]++
28 if $z;
29
30 11 for (0 .. 2)
33
31 {
32 33 $x[3]++;
33 }
34
35 *** 11 50 if ($y)
36 {
37 11 $x[4]++;
38 }
39 else
40 {
41 *** 0 0 $y && $x[5]++;
42 }
43
44 11 my $p = $y & $z;
45
46 *** 11 50 $p &&= $y;
47 *** 11 50 $p &&= $z;
48 11 my $q = 1;
49 *** 11 50 $q &&= $_;
50
51 11 pas();
52 }
53
54 sub pas
55 {
56 *** 11 50 11 $y && $z
57 }
58
59 # print join(", ", @x), "\n";
Branches
--------
line err % true false branch
----- --- ------ ------ ------ ------
20 *** 50 11 0 if $y
23 100 10 1 if $y and $x[0]++
27 *** 50 0 11 if $z
35 *** 50 11 0 if ($y) { }
41 *** 0 0 0 if $y
56 *** 50 11 0 if $y
Conditions
----------
and 2 conditions
line err % l !l expr
----- --- ------ ------ ------ ----
46 *** 50 11 0 $p &&= $y
47 *** 50 11 0 $p &&= $z
49 *** 50 0 11 $q &&= $_
and 3 conditions
line err % !l l&&!r l&&r expr
----- --- ------ ------ ------ ------ ----
23 *** 66 0 1 10 $y and $x[0]++
Covered Subroutines
-------------------
Subroutine Count Location
---------- ----- -----------------
BEGIN 1 tests/cond_and:10
BEGIN 1 tests/cond_and:11
pas 11 tests/cond_and:56