summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2003-11-01 14:21:38 +0000
committerNicholas Clark <nick@ccl4.org>2003-11-01 14:21:38 +0000
commit05619474c45b1f1e16eb70c1d9f8b991a7ad459a (patch)
tree46af2aa4ec716ae372d688e7ac26d8bae48dddc4 /t/op
parent1011f542895f26e864b0395a5884b8095479fed5 (diff)
downloadperl-05619474c45b1f1e16eb70c1d9f8b991a7ad459a.tar.gz
Add Internals::HvREHASH to expose the rehashing flag
t/op/hash.t tests that pathological data triggers rehashing p4raw-id: //depot/perl@21604
Diffstat (limited to 't/op')
-rw-r--r--t/op/hash.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/op/hash.t b/t/op/hash.t
new file mode 100644
index 0000000000..3beae8432a
--- /dev/null
+++ b/t/op/hash.t
@@ -0,0 +1,27 @@
+#!./perl -w
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require './test.pl';
+}
+
+use strict;
+
+plan tests => 3;
+
+my %h;
+
+ok (!Internals::HvREHASH(%h), "hash doesn't start with rehash flag on");
+
+foreach (1..10) {
+ $h{"\0"x$_}++;
+}
+
+ok (!Internals::HvREHASH(%h), "10 entries doesn't trigger rehash");
+
+foreach (11..20) {
+ $h{"\0"x$_}++;
+}
+
+ok (Internals::HvREHASH(%h), "20 entries triggers rehash");