7 plan skip_all => "You must set \$ENV{LONG_TESTS} to run the long tests"
8 unless $ENV{LONG_TESTS};
11 use t::common qw( new_fh );
15 use_ok( 'DBM::Deep' );
17 diag "This test can take up to a minute to run. Please be patient.";
19 my ($fh, $filename) = new_fh();
20 my $db = DBM::Deep->new(
22 type => DBM::Deep->TYPE_HASH,
33 warn localtime(time) . ": before put\n";
34 for ( 0 .. $max_keys ) {
35 $foo->put( "hello $_" => "there " . $_ * 2 );
37 warn localtime(time) . ": after put\n";
40 for ( 0 .. $max_keys ) {
42 unless ( $foo->get( "hello $_" ) eq "there " . $_ * 2 ) {
46 is( $count, $max_keys, "We read $count keys" );
47 warn localtime(time) . ": after read\n";
49 my @keys = sort keys %$foo;
50 warn localtime(time) . ": after keys\n";
51 cmp_ok( scalar(@keys), '==', $max_keys + 1, "Number of keys is correct" );
52 my @control = sort map { "hello $_" } 0 .. $max_keys;
53 cmp_deeply( \@keys, \@control, "Correct keys are there" );
55 ok( !exists $foo->{does_not_exist}, "EXISTS works on large hashes for non-existent keys" );
56 is( $foo->{does_not_exist}, undef, "autovivification works on large hashes" );
57 ok( exists $foo->{does_not_exist}, "EXISTS works on large hashes for newly-existent keys" );
58 cmp_ok( scalar(keys %$foo), '==', $max_keys + 2, "Number of keys after autovivify is correct" );
60 warn localtime(time) . ": before clear\n";
62 warn localtime(time) . ": after clear\n";
63 cmp_ok( scalar(keys %$db), '==', 0, "Number of keys after clear() is correct" );