File: compare.t

package info (click to toggle)
libmldbm-perl 2.04-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 128 kB
  • ctags: 42
  • sloc: perl: 375; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (3)
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

use MLDBM;

my $c = 'c';
my $d = 'd';
my $data = { a => 1, b => [0,1], c => \$c };
$data->{recurse} = $data;

my $err_array = { a => 1, b => [0,2], c => \$c };
$err_array->{recurse} = $err_array;

my $err_hash = { a => 2, b => [0,1], c => \$c };
$err_hash->{recurse} = $err_hash;

my $err_scalar = { a => 1, b => [0,1], c => \$d };
$err_scalar->{recurse} = $err_scalar;

my $err_recurse = { a => 1, b => [0,1], c => \$c };
$err_recurse->{recurse} = {};

print "1..6\n";

for ($err_array, $err_hash, $err_scalar, $err_recurse) {
    if(! &MLDBM::_compare($data, $_)) {
	print "ok\n";
    } else {
	print "not ok\n";
    }
}

my $data_ok = { a => 1, b => [0,1], c => \$c };
$data_ok->{recurse} = $data;

for ($data, $data_ok) {
    if(&MLDBM::_compare($data, $_)) {
	print "ok\n";
    } else {
	print "not ok\n";
    }
}