Permalink
Please sign in to comment.
Browse files
Fix more similar branch coverage problems.
Add tests from the RT tickets.
- Loading branch information...
Showing
with
325 additions
and 0 deletions.
- +2 −0 Changes
- +46 −0 test_output/cover/bigint.5.006001
- +62 −0 test_output/cover/bigint.5.008
- +62 −0 test_output/cover/bigint.5.008001
- +93 −0 test_output/cover/readonly.5.008002
- +16 −0 tests/bigint
- +44 −0 tests/readonly
@@ -0,0 +1,46 @@ | ||
+Reading database from ... | ||
+ | ||
+ | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+File stmt bran cond sub total | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+tests/bigint 100.0 50.0 n/a n/a 75.0 | ||
+Total 100.0 50.0 n/a n/a 75.0 | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+ | ||
+ | ||
+Run: ... | ||
+Perl version: ... | ||
+OS: ... | ||
+Start: ... | ||
+Finish: ... | ||
+ | ||
+tests/bigint | ||
+ | ||
+line err stmt bran cond sub code | ||
+1 #!/usr/bin/perl | ||
+2 | ||
+3 # Copyright 2012, Paul Johnson (paul@pjcj.net) | ||
+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 use strict; | ||
+11 use warnings; | ||
+12 | ||
+13 use Math::BigInt ":constant"; | ||
+14 | ||
+15 1 my $x = 1; | ||
+16 *** 1 50 print $x if 1 >= $x; | ||
+ | ||
+ | ||
+Branches | ||
+-------- | ||
+ | ||
+line err % true false branch | ||
+----- --- ------ ------ ------ ------ | ||
+16 *** 50 1 0 if \('+1') >= $x | ||
+ | ||
+ |
@@ -0,0 +1,62 @@ | ||
+Reading database from ... | ||
+ | ||
+ | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+File stmt bran cond sub total | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+tests/bigint 100.0 50.0 n/a 100.0 93.8 | ||
+Total 100.0 50.0 n/a 100.0 93.8 | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+ | ||
+ | ||
+Run: ... | ||
+Perl version: ... | ||
+OS: ... | ||
+Start: ... | ||
+Finish: ... | ||
+ | ||
+tests/bigint | ||
+ | ||
+line err stmt bran cond sub code | ||
+1 #!/usr/bin/perl | ||
+2 | ||
+3 # Copyright 2012, Paul Johnson (paul@pjcj.net) | ||
+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 1 use Math::BigInt ":constant"; | ||
+ 1 | ||
+ 1 | ||
+14 | ||
+15 1 my $x = 1; | ||
+16 *** 1 50 print $x if 1 >= $x; | ||
+ | ||
+ | ||
+Branches | ||
+-------- | ||
+ | ||
+line err % true false branch | ||
+----- --- ------ ------ ------ ------ | ||
+16 *** 50 1 0 if \(undef) >= $x | ||
+ | ||
+ | ||
+Covered Subroutines | ||
+------------------- | ||
+ | ||
+Subroutine Count Location | ||
+---------- ----- --------------- | ||
+BEGIN 1 tests/bigint:10 | ||
+BEGIN 1 tests/bigint:11 | ||
+BEGIN 1 tests/bigint:13 | ||
+ | ||
+ |
@@ -0,0 +1,62 @@ | ||
+Reading database from ... | ||
+ | ||
+ | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+File stmt bran cond sub total | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+tests/bigint 100.0 50.0 n/a 100.0 93.8 | ||
+Total 100.0 50.0 n/a 100.0 93.8 | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+ | ||
+ | ||
+Run: ... | ||
+Perl version: ... | ||
+OS: ... | ||
+Start: ... | ||
+Finish: ... | ||
+ | ||
+tests/bigint | ||
+ | ||
+line err stmt bran cond sub code | ||
+1 #!/usr/bin/perl | ||
+2 | ||
+3 # Copyright 2012, Paul Johnson (paul@pjcj.net) | ||
+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 1 use Math::BigInt ":constant"; | ||
+ 1 | ||
+ 1 | ||
+14 | ||
+15 1 my $x = 1; | ||
+16 *** 1 50 print $x if 1 >= $x; | ||
+ | ||
+ | ||
+Branches | ||
+-------- | ||
+ | ||
+line err % true false branch | ||
+----- --- ------ ------ ------ ------ | ||
+16 *** 50 1 0 if {sign => '+', value => [1]} >= $x | ||
+ | ||
+ | ||
+Covered Subroutines | ||
+------------------- | ||
+ | ||
+Subroutine Count Location | ||
+---------- ----- --------------- | ||
+BEGIN 1 tests/bigint:10 | ||
+BEGIN 1 tests/bigint:11 | ||
+BEGIN 1 tests/bigint:13 | ||
+ | ||
+ |
@@ -0,0 +1,93 @@ | ||
+Reading database from ... | ||
+ | ||
+ | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+File stmt bran cond sub total | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+tests/readonly 100.0 100.0 n/a 100.0 100.0 | ||
+Total 100.0 100.0 n/a 100.0 100.0 | ||
+------------------------------------------ ------ ------ ------ ------ ------ | ||
+ | ||
+ | ||
+Run: ... | ||
+Perl version: ... | ||
+OS: ... | ||
+Start: ... | ||
+Finish: ... | ||
+ | ||
+tests/readonly | ||
+ | ||
+line err stmt bran cond sub code | ||
+1 #!/usr/bin/perl | ||
+2 | ||
+3 # Copyright 2012, Paul Johnson (paul@pjcj.net) | ||
+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 # __COVER__ skip_test $] < 5.008002 || !(eval "use Moo; 23") | ||
+11 # __COVER__ skip_reason Readonly not available | ||
+12 | ||
+13 1 1 use strict; | ||
+ 1 | ||
+ 1 | ||
+14 1 1 use warnings; | ||
+ 1 | ||
+ 1 | ||
+15 | ||
+16 1 1 use Readonly; | ||
+ 1 | ||
+ 1 | ||
+17 | ||
+18 1 Readonly my $REGEXP_MATCH => '2'; | ||
+19 1 my @lines = ( '1', '2', '3', 'A', 'B', 'c' ); | ||
+20 | ||
+21 sub test_readonly_coverage { | ||
+22 # All branches executed. | ||
+23 1 1 foreach my $line (@lines) { | ||
+24 6 100 if ($line =~ /$REGEXP_MATCH/msx) { | ||
+25 1 print "true ($line)\n"; | ||
+26 } else { | ||
+27 5 print "false ($line)\n"; | ||
+28 } | ||
+29 } | ||
+30 } | ||
+31 | ||
+32 sub test_posix_regexp { | ||
+33 # All branches executed. | ||
+34 1 1 foreach my $line (@lines) { | ||
+35 6 100 if ($line =~ /[[:upper:]]/msx) { | ||
+36 2 print "true ($line)\n"; | ||
+37 } else { | ||
+38 4 print "false ($line)\n"; | ||
+39 } | ||
+40 } | ||
+41 } | ||
+42 | ||
+43 1 test_readonly_coverage; | ||
+44 1 test_posix_regexp; | ||
+ | ||
+ | ||
+Branches | ||
+-------- | ||
+ | ||
+line err % true false branch | ||
+----- --- ------ ------ ------ ------ | ||
+24 100 1 5 if ($line =~ /$REGEXP_MATCH/msx) { } | ||
+35 100 2 4 if ($line =~ /[[:upper:]]/msx) { } | ||
+ | ||
+ | ||
+Covered Subroutines | ||
+------------------- | ||
+ | ||
+Subroutine Count Location | ||
+---------------------- ----- ----------------- | ||
+BEGIN 1 tests/readonly:13 | ||
+BEGIN 1 tests/readonly:14 | ||
+BEGIN 1 tests/readonly:16 | ||
+test_posix_regexp 1 tests/readonly:34 | ||
+test_readonly_coverage 1 tests/readonly:23 | ||
+ | ||
+ |
16
tests/bigint
@@ -0,0 +1,16 @@ | ||
+#!/usr/bin/perl | ||
+ | ||
+# Copyright 2012, Paul Johnson (paul@pjcj.net) | ||
+ | ||
+# This software is free. It is licensed under the same terms as Perl itself. | ||
+ | ||
+# The latest version of this software should be available from my homepage: | ||
+# http://www.pjcj.net | ||
+ | ||
+use strict; | ||
+use warnings; | ||
+ | ||
+use Math::BigInt ":constant"; | ||
+ | ||
+my $x = 1; | ||
+print $x if 1 >= $x; |
@@ -0,0 +1,44 @@ | ||
+#!/usr/bin/perl | ||
+ | ||
+# Copyright 2012, Paul Johnson (paul@pjcj.net) | ||
+ | ||
+# This software is free. It is licensed under the same terms as Perl itself. | ||
+ | ||
+# The latest version of this software should be available from my homepage: | ||
+# http://www.pjcj.net | ||
+ | ||
+# __COVER__ skip_test $] < 5.008002 || !(eval "use Moo; 23") | ||
+# __COVER__ skip_reason Readonly not available | ||
+ | ||
+use strict; | ||
+use warnings; | ||
+ | ||
+use Readonly; | ||
+ | ||
+Readonly my $REGEXP_MATCH => '2'; | ||
+my @lines = ( '1', '2', '3', 'A', 'B', 'c' ); | ||
+ | ||
+sub test_readonly_coverage { | ||
+ # All branches executed. | ||
+ foreach my $line (@lines) { | ||
+ if ($line =~ /$REGEXP_MATCH/msx) { | ||
+ print "true ($line)\n"; | ||
+ } else { | ||
+ print "false ($line)\n"; | ||
+ } | ||
+ } | ||
+} | ||
+ | ||
+sub test_posix_regexp { | ||
+ # All branches executed. | ||
+ foreach my $line (@lines) { | ||
+ if ($line =~ /[[:upper:]]/msx) { | ||
+ print "true ($line)\n"; | ||
+ } else { | ||
+ print "false ($line)\n"; | ||
+ } | ||
+ } | ||
+} | ||
+ | ||
+test_readonly_coverage; | ||
+test_posix_regexp; |
0 comments on commit
69cd295