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