Start preparing the Changes file for 1.0015
[dbsrgits/DBM-Deep.git] / t_attic / 36_verybighash.t
CommitLineData
e9b0b5f0 1# This test was contributed by Fedor Soreks, Jan 2007.
2
3use strict;
4use Test::More;
5
6plan skip_all => "You must set \$ENV{LONG_TESTS} >= 2 to run the superlong tests"
7 unless $ENV{LONG_TESTS} && $ENV{LONG_TESTS} >= 2;
8
9use Test::Deep;
10use t::common qw( new_fh );
11
12plan tests => 2;
13
14use_ok( 'DBM::Deep' );
15
16diag "This test can take up to several hours to run. Please be VERY patient.";
17
18my ($fh, $filename) = new_fh();
19my $db = DBM::Deep->new(
20 file => $filename,
21 type => DBM::Deep->TYPE_HASH,
22);
23
24my $gigs = 2;
25
26##
27# put/get many keys
28##
29my $max_keys = 4_000_000;
30my $max_record_keys = 10;
31
32for my $key_no ( 0 .. $max_keys ) {
33 for my $rec_no ( 0 .. $max_record_keys ) {
34 $db->{"key_$key_no"}{"rec_key_$rec_no"} = "rec_val_$rec_no";
35 }
36
37 my $s = -s $filename;
38 print "$key_no: $s\n";
39
40 if ( $s > $gigs * 2**30) {
41 fail "DB file ($filename) size exceeds $gigs GB";
42 exit;
43 }
44}
45
46ok( 1, "We passed the test!" );