Added missing files to the MANIFEST
[dbsrgits/DBM-Deep.git] / t / 03_bighash.t
CommitLineData
ffed8b01 1##
2# DBM::Deep Test
3##
4use strict;
a4e2db58 5use Test::More tests => 2;
2a81bf9e 6use File::Temp qw( tempfile tempdir );
58910373 7use Fcntl qw( :flock );
ffed8b01 8
9use_ok( 'DBM::Deep' );
10
2a81bf9e 11my $dir = tempdir( CLEANUP => 1 );
12my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
58910373 13flock $fh, LOCK_UN;
ffed8b01 14my $db = DBM::Deep->new(
2a81bf9e 15 file => $filename,
ffed8b01 16 type => DBM::Deep->TYPE_HASH
17);
ffed8b01 18
19##
20# put/get many keys
21##
a4e2db58 22my $max_keys = 4000;
23
ffed8b01 24for ( 0 .. $max_keys ) {
25 $db->put( "hello $_" => "there " . $_ * 2 );
26}
27
30029562 28my $count = -1;
ffed8b01 29for ( 0 .. $max_keys ) {
30029562 30 $count = $_;
31 unless ( $db->get( "hello $_" ) eq "there " . $_ * 2 ) {
32 last;
33 };
ffed8b01 34}
30029562 35is( $count, $max_keys, "We read $count keys" );