13 $h{'jkl','mno'} = "JKL\034MNO";
14 $h{'a',2,3,4,5} = join("\034",'A',2,3,4,5);
45 if ($#keys == 29 && $#values == 29) {print "ok 1\n";} else {print "not ok 1\n";}
47 $i = 0; # stop -w complaints
49 while (($key,$value) = each(%h)) {
50 if ($key eq $keys[$i] && $value eq $values[$i]
51 && (('a' lt 'A' && $key lt $value) || $key gt $value)) {
53 $i++ if $key eq $value;
57 if ($i == 30) {print "ok 2\n";} else {print "not ok 2\n";}
59 @keys = ('blurfl', keys(%h), 'dyick');
60 if ($#keys == 31) {print "ok 3\n";} else {print "not ok 3\n";}
62 $size = ((split('/',scalar %h))[1]);
64 $newsize = ((split('/',scalar %h))[1]);
65 if ($newsize == $size * 8) {print "ok 4\n";} else {print "not ok 4\n";}
67 $size = ((split('/',scalar %h))[1]);
68 if ($size == $newsize) {print "ok 5\n";} else {print "not ok 5\n";}
70 $size = ((split('/',scalar %h))[1]);
71 if ($size == $newsize) {print "ok 6\n";} else {print "not ok 6\n";}
74 $size = ((split('/',scalar %h))[1]);
75 if ($size == 8) {print "ok 7\n";} else {print "not ok 7\n";}
80 $total += $key while $key = each %hash;
81 print "# Scalar each is bad.\nnot " unless $total == 100;
84 for (1..3) { @foo = each %hash }
87 $total += $key while $key = each %hash;
88 print "# Scalar keys isn't resetting the iterator.\nnot " if $total != 100;
91 for (1..3) { @foo = each %hash }
93 $total += $key while $key = each %hash;
94 print "# Iterator of each isn't being maintained.\nnot " if $total == 100;
97 for (1..3) { @foo = each %hash }
100 $total += $key while $key = each %hash;
101 print "# Scalar values isn't resetting the iterator.\nnot " if $total != 100;
104 $size = (split('/', scalar %hash))[1];
105 keys(%hash) = $size / 2;
106 print "not " if $size != (split('/', scalar %hash))[1];
108 keys(%hash) = $size + 100;
109 print "not " if $size == (split('/', scalar %hash))[1];
112 print "not " if keys(%hash) != 10;
115 print keys(hash) != 10 ? "not ok 15\n" : "ok 15\n";
118 %h = (a => A, b => B, c=> C, d => D, abc => ABC);
121 while (($key, $value) = each(h)) {
122 if ($key eq $keys[$i] && $value eq $values[$i] && $key eq lc($value)) {
126 if ($i == 5) { print "ok 16\n" } else { print "not ok\n" }
130 sub DESTROY { print "ok 18\n"; }
132 my $h = { A => bless [], __PACKAGE__ };
133 while (my($k,$v) = each %$h) {
134 print "ok 17\n" if $k eq 'A' and ref($v) eq 'Obj';
140 # Check for Unicode hash keys.
141 %u = ("\x{12}", "f", "\x{123}", "fo", "\x{1234}", "foo");
142 $u{"\x{12345}"} = "bar";
143 @u{"\x{123456}"} = "zap";
146 unless (length() == 1) {
153 $a = "\xe3\x81\x82"; $A = "\x{3042}";
154 %b = ( $a => "non-utf8");
155 %u = ( $A => "utf8");
157 print "not " if exists $b{$A};
159 print "not " if exists $u{$a};
161 print "#$b{$_}\n" for keys %b; # Used to core dump before change #8056.
163 print "#$u{$_}\n" for keys %u; # Used to core dump before change #8056.
166 $d = qu"\xe3\x81\x82";
167 %u = ($d => "downgrade");
170 print "not " if length ne 3 or $_ ne "\xe3\x81\x82";
175 print "not " if length($d) ne 6 or $d ne qu"\xe3\x81\x82";