3 use Test::More tests => 17;
5 use Variable::Magic qw/wizard cast dispell/;
11 for (0 .. 4) { return 0 unless $c[$_] == $x[$_]; }
15 my $wiz = wizard get => sub { ++$c[0] },
16 set => sub { ++$c[1] },
17 len => sub { ++$c[2]; $_[2] },
18 clear => sub { ++$c[3] },
19 free => sub { ++$c[4] };
20 ok(check(), 'hash : create wizard');
22 my %n = map { $_ => int rand 1000 } qw/foo bar baz qux/;
26 ok(check(), 'hash : cast');
29 ok(check(), 'hash : assign element to');
32 ok(check(), 'hash : assign to');
35 ok(check(), 'hash : interpolate');
38 ok(check(), 'hash : reference');
40 my @b = @a{qw/bar qux/};
41 ok(check(), 'hash : slice');
43 %a = map { $_ => 1 } qw/a b d/;
45 ok(check(), 'hash : assign');
48 ok(check(), 'hash : assign old element');
51 ok(check(), 'hash : assign new element');
54 ok(check(), 'hash : buckets');
57 ok(check(), 'hash : keys');
60 ok(check(), 'hash : values');
62 while (my ($k, $v) = each %a) { }
63 ok(check(), 'hash : each');
70 ok(check(), 'hash : scope end');
74 ok(check(), 'hash : undef');
77 ok(check(), 'hash : dispel');