Commit | Line | Data |
2120a181 |
1 | ## |
2 | # DBM::Deep Test |
3 | ## |
4 | use strict; |
5 | use Test::More tests => 4; |
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 | ); |
14 | |
15 | ## |
16 | # large keys |
17 | ## |
18 | my $val1 = "a" x 1000; |
19 | |
20 | $db->{foo} = $val1; |
21 | is( $db->{foo}, $val1, "1000 char value stored and retrieved" ); |
22 | |
23 | delete $db->{foo}; |
24 | my $size = -s $filename; |
25 | $db->{bar} = "a" x 300; |
26 | is( $db->{bar}, 'a' x 300, "New 256 char value is stored" ); |
27 | cmp_ok( $size, '==', -s $filename, "Freespace is reused" ); |