New testing feature that allows specification of the workdir for the tests
[dbsrgits/DBM-Deep.git] / t / 03_bighash.t
1 ##
2 # DBM::Deep Test
3 ##
4 use strict;
5 use Test::More tests => 2;
6 use t::common qw( new_fh );
7
8 use_ok( 'DBM::Deep' );
9
10 my ($fh, $filename) = new_fh();
11 my $db = DBM::Deep->new(
12         file => $filename,
13         type => DBM::Deep->TYPE_HASH
14 );
15
16 ##
17 # put/get many keys
18 ##
19 my $max_keys = 4000;
20
21 for ( 0 .. $max_keys ) {
22     $db->put( "hello $_" => "there " . $_ * 2 );
23 }
24
25 my $count = -1;
26 for ( 0 .. $max_keys ) {
27     $count = $_;
28     unless ( $db->get( "hello $_" ) eq "there " . $_ * 2 ) {
29         last;
30     };
31 }
32 is( $count, $max_keys, "We read $count keys" );