---------------------------- ------ ------ ------ ------ ------ ------ ------
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<http://groups.google.com/group/DBM-Deep>
# 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();
);
$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" );
}
{
$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
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" );
+}