Commit | Line | Data |
---|---|---|
ffed8b01 | 1 | ## |
2 | # DBM::Deep Test | |
3 | ## | |
4 | use strict; | |
9ab67b8c | 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_ARRAY | |
13 | ); | |
ffed8b01 | 14 | |
15 | ## | |
16 | # put/get many keys | |
17 | ## | |
9ab67b8c | 18 | my $max_keys = 4000; |
19 | ||
ffed8b01 | 20 | for ( 0 .. $max_keys ) { |
21 | $db->put( $_ => $_ * 2 ); | |
22 | } | |
23 | ||
30029562 | 24 | my $count = -1; |
ffed8b01 | 25 | for ( 0 .. $max_keys ) { |
30029562 | 26 | $count = $_; |
a4e2db58 | 27 | unless ( $db->get( $_ ) == $_ * 2 ) { |
30029562 | 28 | last; |
29 | }; | |
ffed8b01 | 30 | } |
30029562 | 31 | is( $count, $max_keys, "We read $count keys" ); |