fix hash order dependency in ext/B/t/b.t
authorYves Orton <demerphq@gmail.com>
Mon, 27 Aug 2012 06:53:54 +0000 (08:53 +0200)
committerYves Orton <demerphq@gmail.com>
Fri, 26 Oct 2012 09:46:31 +0000 (11:46 +0200)
Hash seed randomization causes these tests to fail occasionally.

ext/B/t/b.t

index 85e0247..02353f9 100644 (file)
@@ -218,8 +218,12 @@ is(B::opnumber("pp_null"), 0, "Testing opnumber with opname (pp_null)");
     like($hash, qr/\A0x[0-9a-f]+\z/, "Testing B::hash(\"wibble\")");
     unlike($hash, qr/\A0x0+\z/, "Testing B::hash(\"wibble\")");
 
-    like(B::hash("\0" x $_), qr/\A0x0+\z/, "Testing B::hash(\"0\" x $_)")
-        for 0..19;
+    SKIP: {
+        skip "Nulls don't hash to the same bucket regardless of length with this PERL_HASH implementation", 20
+            if B::hash("") ne B::hash("\0" x 19);
+        like(B::hash("\0" x $_), qr/\A0x0+\z/, "Testing B::hash(\"0\" x $_)")
+             for 0..19;
+    }
 
     $hash = eval {B::hash(chr 256)};
     is($hash, undef, "B::hash() refuses non-octets");