5 use Test::More tests => 13;
10 my $db = DBM::Deep->new( "t/test.db" );
12 die "ERROR: " . $db->error();
18 $db->{key1} = "value1";
19 $db->{key2} = "value2";
22 # Insert circular reference
27 # Make sure keys exist in both places
29 is( $db->{key1}, 'value1', "The value is there directly" );
30 is( $db->{circle}{key1}, 'value1', "The value is there in one loop of the circle" );
31 is( $db->{circle}{circle}{key1}, 'value1', "The value is there in two loops of the circle" );
32 is( $db->{circle}{circle}{circle}{key1}, 'value1', "The value is there in three loops of the circle" );
35 # Make sure changes are reflected in both places
37 $db->{key1} = "another value";
39 is( $db->{key1}, 'another value', "The value is there directly" );
40 is( $db->{circle}{key1}, 'another value', "The value is there in one loop of the circle" );
41 is( $db->{circle}{circle}{key1}, 'another value', "The value is there in two loops of the circle" );
42 is( $db->{circle}{circle}{circle}{key1}, 'another value', "The value is there in three loops of the circle" );
44 $db->{circle}{circle}{circle}{circle}{key1} = "circles";
46 is( $db->{key1}, 'circles', "The value is there directly" );
47 is( $db->{circle}{key1}, 'circles', "The value is there in one loop of the circle" );
48 is( $db->{circle}{circle}{key1}, 'circles', "The value is there in two loops of the circle" );
49 is( $db->{circle}{circle}{circle}{key1}, 'circles', "The value is there in three loops of the circle" );