diff --git a/test_output/cover/cond_chained.5.006001 b/test_output/cover/cond_chained.5.006001 new file mode 100644 index 00000000..082285a8 --- /dev/null +++ b/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 + + diff --git a/test_output/cover/cond_chained.5.008001 b/test_output/cover/cond_chained.5.008001 new file mode 100644 index 00000000..8af844b6 --- /dev/null +++ b/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 + + diff --git a/test_output/cover/cond_chained.5.016000 b/test_output/cover/cond_chained.5.016000 new file mode 100644 index 00000000..b6baed95 --- /dev/null +++ b/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 + + diff --git a/tests/cond_chained b/tests/cond_chained new file mode 100644 index 00000000..bc1c8dfb --- /dev/null +++ b/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;