From: rkinyon Date: Thu, 18 Jan 2007 15:17:08 +0000 (+0000) Subject: r14853@rob-kinyons-computer: rob | 2007-01-18 02:01:33 -0500 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7578f62a0a37f62fa09a90f8f44f0f899d36f138;p=dbsrgits%2FDBM-Deep.git r14853@rob-kinyons-computer: rob | 2007-01-18 02:01:33 -0500 More POD cleanups, couple more tests, and better code coverage --- diff --git a/lib/DBM/Deep.pod b/lib/DBM/Deep.pod index 6d05677..4bab964 100644 --- a/lib/DBM/Deep.pod +++ b/lib/DBM/Deep.pod @@ -1071,11 +1071,12 @@ B report on this distribution's test suite. ---------------------------- ------ ------ ------ ------ ------ ------ ------ blib/lib/DBM/Deep.pm 96.8 87.9 90.5 100.0 89.5 4.6 95.2 blib/lib/DBM/Deep/Array.pm 100.0 94.3 100.0 100.0 100.0 5.0 98.7 - blib/lib/DBM/Deep/Engine.pm 95.6 85.1 79.7 99.1 0.0 58.2 89.5 - blib/lib/DBM/Deep/File.pm 99.0 88.9 77.8 100.0 0.0 29.9 90.3 - blib/lib/DBM/Deep/Hash.pm 100.0 100.0 100.0 100.0 100.0 2.4 100.0 - Total 97.0 87.8 84.0 99.5 32.1 100.0 92.4 + blib/lib/DBM/Deep/Engine.pm 97.5 86.4 79.7 100.0 0.0 58.6 90.9 + blib/lib/DBM/Deep/File.pm 99.0 88.9 77.8 100.0 0.0 29.3 90.3 + blib/lib/DBM/Deep/Hash.pm 100.0 100.0 100.0 100.0 100.0 2.5 100.0 + Total 98.0 88.6 84.0 100.0 32.1 100.0 93.2 ---------------------------- ------ ------ ------ ------ ------ ------ ------ + =head1 MORE INFORMATION Check out the DBM::Deep Google Group at L diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 8526b92..690fff2 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -1656,6 +1656,8 @@ sub mark_deleted { ); } +=pod +# This has been commented out until it is used in order to not bring coverage stats down. sub delete_md5 { my $self = shift; my ($args) = @_; @@ -1688,6 +1690,7 @@ sub delete_md5 { return $data; } +=cut sub get_data_location_for { my $self = shift; diff --git a/t/13_setpack.t b/t/13_setpack.t index 8f6d2cc..fe8be0f 100644 --- a/t/13_setpack.t +++ b/t/13_setpack.t @@ -2,12 +2,13 @@ # DBM::Deep Test ## use strict; -use Test::More tests => 4; +use Config; +use Test::More tests => 10; use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); -my ($before, $after); +my ($default, $small, $medium, $large); { my ($fh, $filename) = new_fh(); @@ -17,7 +18,34 @@ my ($before, $after); ); $db->{key1} = "value1"; $db->{key2} = "value2"; - $before = (stat($db->_fh()))[7]; + $default = (stat($db->_fh()))[7]; +} + +{ + my ($fh, $filename) = new_fh(); + { + my $db = DBM::Deep->new( + file => $filename, + autoflush => 1, + pack_size => 'medium', + ); + + $db->{key1} = "value1"; + $db->{key2} = "value2"; + $medium = (stat($db->_fh()))[7]; + } + + # This tests the header to verify that the pack_size is really there + { + my $db = DBM::Deep->new( + file => $filename, + ); + + is( $db->{key1}, 'value1', 'Can read key1' ); + is( $db->{key2}, 'value2', 'Can read key2' ); + } + + cmp_ok( $medium, '==', $default, "The default is medium" ); } { @@ -31,7 +59,7 @@ my ($before, $after); $db->{key1} = "value1"; $db->{key2} = "value2"; - $after = (stat($db->_fh()))[7]; + $small = (stat($db->_fh()))[7]; } # This tests the header to verify that the pack_size is really there @@ -43,6 +71,35 @@ my ($before, $after); is( $db->{key1}, 'value1', 'Can read key1' ); is( $db->{key2}, 'value2', 'Can read key2' ); } + + cmp_ok( $medium, '>', $small, "medium is greater than small" ); } -cmp_ok( $after, '<', $before, "The new packsize reduced the size of the file" ); +SKIP: { + skip "Largefile support is not compiled into $^X", 3 + if 1; #unless $Config{ uselargefile }; + + my ($fh, $filename) = new_fh(); + { + my $db = DBM::Deep->new( + file => $filename, + autoflush => 1, + pack_size => 'large', + ); + + $db->{key1} = "value1"; + $db->{key2} = "value2"; + $large = (stat($db->_fh()))[7]; + } + + # This tests the header to verify that the pack_size is really there + { + my $db = DBM::Deep->new( + file => $filename, + ); + + is( $db->{key1}, 'value1', 'Can read key1' ); + is( $db->{key2}, 'value2', 'Can read key2' ); + } + cmp_ok( $medium, '<', $large, "medium is smaller than large" ); +} diff --git a/t/TODO b/t/TODO index e5da204..ea548e0 100644 --- a/t/TODO +++ b/t/TODO @@ -64,7 +64,7 @@ How should this be triggered?! =over 4 -=item * Should all assignments happen within a sub-transaction? +=item * Should all assignments with a non-scalar rvalue happen within a sub-transaction? =item * Does this mean that sub-transactions should just be done right now?