7 use Test::Leaner tests => 3 * 4 * (8 ** 3) * 2;
17 my (@vlex, %vlex, $vrlex);
18 our (@vgbl, %vgbl, $vrgbl);
21 '$vlex', # lexical array/hash
22 '$vgbl', # global array/hash
23 '$vrlex->', # lexical array/hash reference
24 '$vrgbl->', # global array/hash reference
31 '[0]', # array const (aelemfast)
32 '[$lex]', # array lexical
33 '[$gbl]', # array global
34 '[$lex+1]', # array complex
36 '{$lex}', # hash lexical
37 '{$gbl}', # hash global
38 '{"x$lex"}' # hash complex
42 (@vlex, %vlex, $vrlex) = ();
43 (@vgbl, %vgbl, $vrgbl) = ();
49 package autovivification::TestIterator;
58 idx => [ (0) x $len ],
65 my ($len, $max, $idx) = @$self{qw<len max idx>};
69 for ($i = 0; $i < $len; ++$i) {
70 if ($idx->[$i] == $max->[$i]) {
72 ++$idx->[$i + 1] unless $i == $len - 1;
84 my ($len, $idx) = @$self{qw<len idx>};
86 return map $_[$_]->[$idx->[$_]], 0 .. ($len - 1);
90 my $iterator = autovivification::TestIterator->new(3, 4, (8) x $depth);
92 my @elems = $iterator->pick(\@prefixes, \@heads, (\@derefs) x $depth);
93 my $code = join '', @elems;
94 my $exp = $elems[0] eq 'exists ' ? !1 : undef;
96 my ($res, $err) = do {
97 local $SIG{__WARN__} = sub { die @_ };
99 my $r = eval <<" CODE";
105 is $err, '', "$code: no exception";
106 is $res, $exp, "$code: value";
107 } while ($iterator->next);