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