Permalink
Browse files

Fix more similar branch coverage problems.

Add tests from the RT tickets.
  • Loading branch information...
pjcj committed Sep 20, 2012
1 parent b33679b commit 69cd295799f0a6d8c5e1d8aceaa4f27d244dcf10
View
@@ -4,6 +4,8 @@ Devel::Cover history
- Fix loss of condition coverage data when first operand calls into ignored
file (Celogeek, Christian Walde) (rt 63090) (github 15, 20).
- Fix similar problem with branch coverage (Robert Freimuth) (rt 72027).
+ - More similar problems (Brian Cassidy, Florian Ragwitz, Heikki J Laaksonen)
+ (rt 63698).
Release 0.94 - 18 September 2012
- Officially support 5.16.1.
@@ -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
+
+
View
@@ -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;
View
@@ -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

Please sign in to comment.