Commit | Line | Data |
ffed8b01 |
1 | ## |
2 | # DBM::Deep Test |
3 | ## |
4 | use strict; |
a4e2db58 |
5 | use Test::More tests => 2; |
ffed8b01 |
6 | |
7 | use_ok( 'DBM::Deep' ); |
8 | |
9 | unlink "t/test.db"; |
10 | my $db = DBM::Deep->new( |
11 | file => "t/test.db", |
12 | type => DBM::Deep->TYPE_HASH |
13 | ); |
14 | if ($db->error()) { |
15 | die "ERROR: " . $db->error(); |
16 | } |
17 | |
18 | ## |
19 | # put/get many keys |
20 | ## |
a4e2db58 |
21 | my $max_keys = 4000; |
22 | |
ffed8b01 |
23 | for ( 0 .. $max_keys ) { |
24 | $db->put( "hello $_" => "there " . $_ * 2 ); |
25 | } |
26 | |
30029562 |
27 | my $count = -1; |
ffed8b01 |
28 | for ( 0 .. $max_keys ) { |
30029562 |
29 | $count = $_; |
30 | unless ( $db->get( "hello $_" ) eq "there " . $_ * 2 ) { |
31 | last; |
32 | }; |
ffed8b01 |
33 | } |
30029562 |
34 | is( $count, $max_keys, "We read $count keys" ); |