diff --git a/test_output/cover/dbm_cond.5.014000 b/test_output/cover/dbm_cond.5.014000 new file mode 100644 index 00000000..3a0d9233 --- /dev/null +++ b/test_output/cover/dbm_cond.5.014000 @@ -0,0 +1,105 @@ +Reading database from ... + + +-------------- ------ ------ ------ ------ ------ +File stmt bran cond sub total +-------------- ------ ------ ------ ------ ------ +tests/dbm_cond 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/dbm_cond + +line err stmt bran cond sub code +1 #!/usr/bin/perl +2 +3 # Copyright 2012-2024, 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.008005 || !(eval "use DBM::Deep; 23") +11 # __COVER__ skip_reason DBM::Deep not available +12 +13 1 1 use strict; + 1 + 1 +14 1 1 use warnings; + 1 + 1 +15 +16 1 1 use Test::More; + 1 + 1 +17 +18 1 1 use DBM::Deep; + 1 + 1 +19 +20 1 my $db = DBM::Deep->new( "temp.db" ); +21 1 $db->{1} = 1; +22 +23 1 my $h = { 1 => 1 }; +24 +25 sub testdbm { +26 2 2 my ( $p ) = @_; +27 +28 2 100 if( exists $db->{$p} ) { +29 1 return "dbm: exists"; +30 } else { +31 1 return "dbm: does not exist"; +32 } +33 } +34 +35 sub testh { +36 2 2 my ( $p ) = @_; +37 +38 2 100 if( exists $h->{$p} ) { +39 1 return "h: exists"; +40 } else { +41 1 return "h: does not exist"; +42 } +43 } +44 +45 1 is( testdbm( 1 ), "dbm: exists", "key exists in dbm" ); +46 1 is( testdbm( 2 ), "dbm: does not exist", "key does not exist in dbm" ); +47 +48 1 is( testh( 1 ), "h: exists", "key exists in h" ); +49 1 is( testh( 2 ), "h: does not exist", "key does not exist in h" ); +50 +51 1 unlink "temp.db"; +52 +53 1 done_testing(); + + +Branches +-------- + +line err % true false branch +----- --- ------ ------ ------ ------ +28 100 1 1 if (exists $$db{$p}) { } +38 100 1 1 if (exists $$h{$p}) { } + + +Covered Subroutines +------------------- + +Subroutine Count Location +---------- ----- ----------------- +BEGIN 1 tests/dbm_cond:13 +BEGIN 1 tests/dbm_cond:14 +BEGIN 1 tests/dbm_cond:16 +BEGIN 1 tests/dbm_cond:18 +testdbm 2 tests/dbm_cond:26 +testh 2 tests/dbm_cond:36 + + diff --git a/test_output/cover/dbm_cond.5.022000 b/test_output/cover/dbm_cond.5.022000 new file mode 100644 index 00000000..56478de3 --- /dev/null +++ b/test_output/cover/dbm_cond.5.022000 @@ -0,0 +1,105 @@ +Reading database from ... + + +-------------- ------ ------ ------ ------ ------ +File stmt bran cond sub total +-------------- ------ ------ ------ ------ ------ +tests/dbm_cond 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/dbm_cond + +line err stmt bran cond sub code +1 #!/usr/bin/perl +2 +3 # Copyright 2012-2024, 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.008005 || !(eval "use DBM::Deep; 23") +11 # __COVER__ skip_reason DBM::Deep not available +12 +13 1 1 use strict; + 1 + 1 +14 1 1 use warnings; + 1 + 1 +15 +16 1 1 use Test::More; + 1 + 1 +17 +18 1 1 use DBM::Deep; + 1 + 1 +19 +20 1 my $db = DBM::Deep->new( "temp.db" ); +21 1 $db->{1} = 1; +22 +23 1 my $h = { 1 => 1 }; +24 +25 sub testdbm { +26 2 2 my ( $p ) = @_; +27 +28 2 100 if( exists $db->{$p} ) { +29 1 return "dbm: exists"; +30 } else { +31 1 return "dbm: does not exist"; +32 } +33 } +34 +35 sub testh { +36 2 2 my ( $p ) = @_; +37 +38 2 100 if( exists $h->{$p} ) { +39 1 return "h: exists"; +40 } else { +41 1 return "h: does not exist"; +42 } +43 } +44 +45 1 is( testdbm( 1 ), "dbm: exists", "key exists in dbm" ); +46 1 is( testdbm( 2 ), "dbm: does not exist", "key does not exist in dbm" ); +47 +48 1 is( testh( 1 ), "h: exists", "key exists in h" ); +49 1 is( testh( 2 ), "h: does not exist", "key does not exist in h" ); +50 +51 1 unlink "temp.db"; +52 +53 1 done_testing(); + + +Branches +-------- + +line err % true false branch +----- --- ------ ------ ------ ------ +28 100 1 1 if (exists $db->{$p}) { } +38 100 1 1 if (exists $h->{$p}) { } + + +Covered Subroutines +------------------- + +Subroutine Count Location +---------- ----- ----------------- +BEGIN 1 tests/dbm_cond:13 +BEGIN 1 tests/dbm_cond:14 +BEGIN 1 tests/dbm_cond:16 +BEGIN 1 tests/dbm_cond:18 +testdbm 2 tests/dbm_cond:26 +testh 2 tests/dbm_cond:36 + +