From: Perl 5 Porters Date: Mon, 7 Oct 1996 19:03:00 +0000 (+0300) Subject: perl 5.003_06: t/op/each.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7503907883139811f2402655acdc3b8f953dd834;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_06: t/op/each.t Date: Mon, 30 Sep 1996 01:13:28 -0400 From: Spider Boardman Subject: Re: pre extending hash? - need speed The patch below (which is relative to perl5.001l) implements "keys %hash = 50_000;" (or other integer-evaluable sizes) for pre-sizing hashes. I've only moved the patch forward from when I first did it. I'm sure the code in hv_ksplit could be improved. Date: Mon, 7 Oct 1996 22:03:00 +0300 From: Jarkko Hietaniemi Subject: LC_COLLATE. Big patch to add, document, and test LC_COLLATE support. A not necessarily gt a. --- diff --git a/t/op/each.t b/t/op/each.t index 7a58fc8..4106e54 100755 --- a/t/op/each.t +++ b/t/op/each.t @@ -2,7 +2,7 @@ # $RCSfile: each.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:47 $ -print "1..3\n"; +print "1..7\n"; $h{'abc'} = 'ABC'; $h{'def'} = 'DEF'; @@ -40,8 +40,10 @@ $h{'z'} = 'Z'; if ($#keys == 29 && $#values == 29) {print "ok 1\n";} else {print "not ok 1\n";} -while (($key,$value) = each(h)) { - if ($key eq $keys[$i] && $value eq $values[$i] && $key gt $value) { +$i = 0; # stop -w complaints + +while (($key,$value) = each(%h)) { + if ($key eq $keys[$i] && $value eq $values[$i] && $key eq lc($value)) { $key =~ y/a-z/A-Z/; $i++ if $key eq $value; } @@ -51,3 +53,18 @@ if ($i == 30) {print "ok 2\n";} else {print "not ok 2\n";} @keys = ('blurfl', keys(%h), 'dyick'); if ($#keys == 31) {print "ok 3\n";} else {print "not ok 3\n";} + +$size = ((split('/',scalar %h))[1]); +keys %h = $size * 5; +$newsize = ((split('/',scalar %h))[1]); +if ($newsize == $size * 8) {print "ok 4\n";} else {print "not ok 4\n";} +keys %h = 1; +$size = ((split('/',scalar %h))[1]); +if ($size == $newsize) {print "ok 5\n";} else {print "not ok 5\n";} +%h = (1,1); +$size = ((split('/',scalar %h))[1]); +if ($size == $newsize) {print "ok 6\n";} else {print "not ok 6\n";} +undef %h; +%h = (1,1); +$size = ((split('/',scalar %h))[1]); +if ($size == 8) {print "ok 7\n";} else {print "not ok 7\n";}