func BenchmarkXxhash32(b *testing.B) { var bv uint32 for i := 0; i < b.N; i++ { bv = N.Checksum32(in) } benchVal32 = bv }
func testEquality(t *testing.T, v []byte) { ch64, ch32 := cxx.Checksum64(v), cxx.Checksum32(v) if h := N.Checksum64(v); ch64 != h { t.Fatalf("Checksum64 doesn't match, len = %d, expected 0x%X, got 0x%X", len(v), ch64, h) } if h := N.Checksum32(v); ch32 != h { t.Fatalf("Checksum32 doesn't match, len = %d, expected 0x%X, got 0x%X", len(v), ch32, h) } h64 := N.New64() h64.Write(v) if h := h64.Sum64(); ch64 != h { t.Fatalf("Sum64() doesn't match, len = %d, expected 0x%X, got 0x%X", len(v), ch64, h) } h32 := N.New32() h32.Write(v) if h := h32.Sum32(); ch32 != h { t.Fatalf("Sum32() doesn't match, len = %d, expected 0x%X, got 0x%X", len(v), ch32, h) } }
func TestHash32Short(t *testing.T) { r := N.Checksum32(in) if r != expected32 { t.Errorf("expected 0x%x, got 0x%x.", expected32, r) } }
func BenchmarkXxhash32(b *testing.B) { for i := 0; i < b.N; i++ { N.Checksum32(in) } }
func BenchmarkXXChecksum32(b *testing.B) { var bv uint32 for i := 0; i < b.N; i++ { bv += N.Checksum32(in) } }