Merge cd5303b: RT# 50541: Fix for clear bug. Introduces a speed regression
[dbsrgits/DBM-Deep.git] / t / 46_blist_reindex.t
1 # This test (and accompanying patch) was submitted by Father Chrysostomos (sprout@cpan.org)
2
3 use 5.006;
4
5 use strict;
6 use warnings FATAL => 'all';
7
8 use Test::More tests => 5;
9
10 use t::common qw( new_fh );
11
12 use_ok( 'DBM::Deep' );
13
14 {
15     my ($fh, $filename) = new_fh();
16     my $db = DBM::Deep->new( $filename );
17     
18     ok eval {
19         for ( # the checksums of all these begin with ^@:
20             qw/ s340l 1970 thronos /,
21             "\320\277\320\276\320\262\320\265\320\273\320\265\320\275".
22             "\320\275\320\276\320\265", qw/ mr094 despite
23             geographically binding bed handmaiden infer lela infranarii
24             lxv evtropia recognizes maladies /
25         ) {
26             $db->{$_} = undef;
27         }
28         1;
29     }, '2 indices can be created at once';
30     
31     is_deeply [sort keys %$db], [ sort
32        qw/ s340l 1970 thronos /,
33         "\320\277\320\276\320\262\320\265\320\273\320\265\320\275".
34         "\320\275\320\276\320\265", qw/ mr094 despite
35         geographically binding bed handmaiden infer lela infranarii
36         lxv evtropia recognizes maladies /
37     ], 'and the keys were stored correctly';
38 }
39
40 {
41     my ($fh, $filename) = new_fh();
42     my $db = DBM::Deep->new( $filename );
43     
44     ok eval {
45         for ( # the checksums of all these begin with ^@^@^@:
46             qw/ dzqtz aqkdqz cxzysd czclmy ktajsi kvlybo kyxowd lvlsda
47                 lyzfdi mbethb mcoqeq VMPJC ATZMZZ AXXJDX BXUUFN EIVTII
48                 FMOKOI HITVDG JSSJSZ JXQPFK LCVVXW /
49         ) {
50             $db->{$_} = undef;
51         }
52         1;
53     }, 'multiple nested indices can be created at once';
54     
55     is_deeply [sort keys %$db], [ sort
56         qw/ dzqtz aqkdqz cxzysd czclmy ktajsi kvlybo kyxowd lvlsda
57             lyzfdi mbethb mcoqeq VMPJC ATZMZZ AXXJDX BXUUFN EIVTII
58             FMOKOI HITVDG JSSJSZ JXQPFK LCVVXW /
59     ], 'and the keys were stored correctly';
60 }
61
62 __END__