Skip to content

Commit

Permalink
Add test for chained conditionals.
Browse files Browse the repository at this point in the history
The test fails under 5.16.0 due to db4d68cf2dda3f17d4e9fb440385189f55271b32 in
perl, but make the golden results match for now until it can be fixed.
  • Loading branch information
pjcj committed May 22, 2012
1 parent 5abc20e commit 7e5cae6
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 0 deletions.
84 changes: 84 additions & 0 deletions test_output/cover/cond_chained.5.006001
@@ -0,0 +1,84 @@
Reading database from ...


------------------------------------------ ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------------------------------ ------ ------ ------ ------ ------
tests/cond_chained 100.0 100.0 86.7 100.0 94.4
Total 100.0 100.0 86.7 100.0 94.4
------------------------------------------ ------ ------ ------ ------ ------


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

tests/cond_chained

line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 sub t1 {
4 1 1 for my $x (0, 1, 2) {
3
5 3 100 100 my $y = 3 if $x && $x == 2;
6 }
7 }
8
9 sub t2 {
10 1 1 for my $x (0, 1, 2) {
2
11 3 100 100 return if $x && $x == 2;
12 }
13 }
14
15 sub t3 {
16 1 1 for my $x (0, 1, 2) {
2
17 3 100 100 last if $x && $x == 2 && $x == 2 && $x == 2;
*** 66
*** 66
18 }
19 }
20
21 1 t1;
22 1 t2;
23 1 t3;


Branches
--------

line err % true false branch
----- --- ------ ------ ------ ------
5 100 1 2 if $x and $x == 2
11 100 1 2 if $x and $x == 2
17 100 1 2 if $x and $x == 2 and $x == 2 and $x == 2


Conditions
----------

and 3 conditions

line err % !l l&&!r l&&r expr
----- --- ------ ------ ------ ------ ----
5 100 1 1 1 $x and $x == 2
11 100 1 1 1 $x and $x == 2
17 100 1 1 1 $x and $x == 2
*** 66 2 0 1 $x and $x == 2 and $x == 2
*** 66 2 0 1 $x and $x == 2 and $x == 2 and $x == 2


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

Subroutine Count Location
---------- ----- ---------------------
t1 1 tests/cond_chained:4
t2 1 tests/cond_chained:10
t3 1 tests/cond_chained:16


81 changes: 81 additions & 0 deletions test_output/cover/cond_chained.5.008001
@@ -0,0 +1,81 @@
Reading database from ...


------------------------------------------ ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------------------------------ ------ ------ ------ ------ ------
tests/cond_chained 100.0 100.0 86.7 100.0 93.9
Total 100.0 100.0 86.7 100.0 93.9
------------------------------------------ ------ ------ ------ ------ ------


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

tests/cond_chained

line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 sub t1 {
4 1 1 for my $x (0, 1, 2) {
5 3 100 100 my $y = 3 if $x && $x == 2;
6 }
7 }
8
9 sub t2 {
10 1 1 for my $x (0, 1, 2) {
11 3 100 100 return if $x && $x == 2;
12 }
13 }
14
15 sub t3 {
16 1 1 for my $x (0, 1, 2) {
17 3 100 100 last if $x && $x == 2 && $x == 2 && $x == 2;
*** 66
*** 66
18 }
19 }
20
21 1 t1;
22 1 t2;
23 1 t3;


Branches
--------

line err % true false branch
----- --- ------ ------ ------ ------
5 100 1 2 if $x and $x == 2
11 100 1 2 if $x and $x == 2
17 100 1 2 if $x and $x == 2 and $x == 2 and $x == 2


Conditions
----------

and 3 conditions

line err % !l l&&!r l&&r expr
----- --- ------ ------ ------ ------ ----
5 100 1 1 1 $x and $x == 2
11 100 1 1 1 $x and $x == 2
17 100 1 1 1 $x and $x == 2
*** 66 2 0 1 $x and $x == 2 and $x == 2
*** 66 2 0 1 $x and $x == 2 and $x == 2 and $x == 2


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

Subroutine Count Location
---------- ----- ---------------------
t1 1 tests/cond_chained:4
t2 1 tests/cond_chained:10
t3 1 tests/cond_chained:16


81 changes: 81 additions & 0 deletions test_output/cover/cond_chained.5.016000
@@ -0,0 +1,81 @@
Reading database from ...


------------------------------------------ ------ ------ ------ ------ ------
File stmt bran cond sub total
------------------------------------------ ------ ------ ------ ------ ------
tests/cond_chained 100.0 83.3 86.7 100.0 90.9
Total 100.0 83.3 86.7 100.0 90.9
------------------------------------------ ------ ------ ------ ------ ------


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

tests/cond_chained

line err stmt bran cond sub code
1 #!/usr/bin/perl
2
3 sub t1 {
4 1 1 for my $x (0, 1, 2) {
5 3 100 100 my $y = 3 if $x && $x == 2;
6 }
7 }
8
9 sub t2 {
10 1 1 for my $x (0, 1, 2) {
11 3 100 100 return if $x && $x == 2;
12 }
13 }
14
15 sub t3 {
16 1 1 for my $x (0, 1, 2) {
17 *** 3 50 100 last if $x && $x == 2 && $x == 2 && $x == 2;
*** 66
*** 66
18 }
19 }
20
21 1 t1;
22 1 t2;
23 1 t3;


Branches
--------

line err % true false branch
----- --- ------ ------ ------ ------
5 100 1 2 if $x and $x == 2
11 100 1 2 if $x and $x == 2
17 *** 50 1 0 if $x and $x == 2 and $x == 2 and $x == 2


Conditions
----------

and 3 conditions

line err % !l l&&!r l&&r expr
----- --- ------ ------ ------ ------ ----
5 100 1 1 1 $x and $x == 2
11 100 1 1 1 $x and $x == 2
17 100 1 1 1 $x and $x == 2
*** 66 2 0 1 $x and $x == 2 and $x == 2
*** 66 1 0 1 $x and $x == 2 and $x == 2 and $x == 2


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

Subroutine Count Location
---------- ----- ---------------------
t1 1 tests/cond_chained:4
t2 1 tests/cond_chained:10
t3 1 tests/cond_chained:16


23 changes: 23 additions & 0 deletions tests/cond_chained
@@ -0,0 +1,23 @@
#!/usr/bin/perl

sub t1 {
for my $x (0, 1, 2) {
my $y = 3 if $x && $x == 2;
}
}

sub t2 {
for my $x (0, 1, 2) {
return if $x && $x == 2;
}
}

sub t3 {
for my $x (0, 1, 2) {
last if $x && $x == 2 && $x == 2 && $x == 2;
}
}

t1;
t2;
t3;

0 comments on commit 7e5cae6

Please sign in to comment.