6 use Test::More tests => 18;
8 use Variable::Magic qw/wizard cast dispell MGf_COPY VMG_UVAR/;
14 is join(':', map { (defined) ? $_ : 'u' } @c[0 .. 11]),
15 join(':', map { (defined) ? $_ : 'u' } @x[0 .. 11]),
19 my $wiz = wizard get => sub { ++$c[0] },
20 set => sub { ++$c[1] },
21 len => sub { ++$c[2]; $_[2] },
22 clear => sub { ++$c[3] },
23 free => sub { ++$c[4] },
24 copy => sub { ++$c[5] },
25 dup => sub { ++$c[6] },
26 local => sub { ++$c[7] },
27 fetch => sub { ++$c[8] },
28 store => sub { ++$c[9] },
29 'exists' => sub { ++$c[10] },
30 'delete' => sub { ++$c[11] };
31 check('hash : create wizard');
33 my %n = map { $_ => int rand 1000 } qw/foo bar baz qux/;
42 check('hash : assign element to');
45 check('hash : assign to');
48 check('hash : interpolate');
51 check('hash : reference');
53 my @b = @a{qw/bar qux/};
54 $x[5] += 2 if MGf_COPY;
55 $x[8] += 2 if VMG_UVAR;
56 check('hash : slice');
58 %a = (a => 1, d => 3);
60 $x[5] += 2 if VMG_UVAR;
61 $x[9] += 2 if VMG_UVAR;
62 check('hash : assign from list');
64 %a = map { $_ => 1 } qw/a b d/;
66 $x[5] += 3 if VMG_UVAR;
67 $x[9] += 3 if VMG_UVAR;
68 check('hash : assign from map');
73 check('hash : assign old element');
78 check('hash : assign new element');
81 check('hash : buckets');
87 check('hash : values');
89 while (my ($k, $v) = each %a) { }
97 check('hash : scope end');
101 check('hash : undef');
104 check('hash : dispel');