1# -*- Mode: CPerl -*- 2 3use strict; 4use warnings; 5 6use Test::More 'no_plan'; 7 8use Hash::MultiKey; 9 10tie my (%hmk), 'Hash::MultiKey'; 11 12my @mk = (["foo"], 13 ["foo", "bar", "baz"], 14 ["foo", "bar", "baz", "zoo"], 15 ["goo"], 16 ["goo", "car", "caz"], 17 ["goo", "car", "caz", "aoo"], 18 ["branch", "with", "no", "bifur$;ations"],); 19 20my @v = (undef, 21 1, 22 'string', 23 ['array', 'ref'], 24 {hash => 'ref', with => 'three', keys => undef}, 25 \7, 26 undef,); 27 28# initialize %hmk 29$hmk{$mk[$_]} = $v[$_] foreach 0..$#mk; 30 31# positive exists 32ok(exists $hmk{$mk[$_]}, "exists key $_") foreach 0..$#mk; 33 34# negative exists 35my @nmk = (["hoo"], # beginning 36 ["foo", "bar"], # intermediate 37 ["foo", "bar", "baz", "zoo", "none here"],); # end 38 39ok(!exists $hmk{$nmk[$_]}, "! exists key $_") foreach 0..$#nmk; 40