Removed error/clear_error functions
[dbsrgits/DBM-Deep.git] / t / 09_deeparray.t
CommitLineData
ffed8b01 1##
2# DBM::Deep Test
3##
995d119b 4$|++;
ffed8b01 5use strict;
6use Test::More;
7
8my $max_levels = 1000;
9
995d119b 10plan tests => 3;
ffed8b01 11
12use_ok( 'DBM::Deep' );
13
14unlink "t/test.db";
15my $db = DBM::Deep->new(
16 file => "t/test.db",
17 type => DBM::Deep->TYPE_ARRAY,
18);
ffed8b01 19
20$db->[0] = [];
21my $temp_db = $db->[0];
22for my $k ( 0 .. $max_levels ) {
23 $temp_db->[$k] = [];
24 $temp_db = $temp_db->[$k];
25}
26$temp_db->[0] = "deepvalue";
27undef $temp_db;
28
29undef $db;
30$db = DBM::Deep->new(
31 file => "t/test.db",
32 type => DBM::Deep->TYPE_ARRAY,
33);
34
995d119b 35my $cur_level = -1;
ffed8b01 36$temp_db = $db->[0];
37for my $k ( 0 .. $max_levels ) {
995d119b 38 $cur_level = $k;
ffed8b01 39 $temp_db = $temp_db->[$k];
995d119b 40 eval { $temp_db->isa( 'DBM::Deep' ) } or last;
ffed8b01 41}
995d119b 42is( $cur_level, $max_levels, "We read all the way down to level $cur_level" );
ffed8b01 43is( $temp_db->[0], "deepvalue", "And we retrieved the value at the bottom of the ocean" );