Closed klauspost closed 3 years ago
Changing the TestCompatWithC_XXH3_64bits to the following produces mismatch after 1088 bytes:
TestCompatWithC_XXH3_64bits
func TestCompatWithC_XXH3_64bits(t *testing.T) { buf := make([]byte, len(testVecs64)) for i, exp := range testVecs64 { buf[i] = byte((i + 1) % 251) if got := Hash(buf[:i]); got != exp { t.Fatalf("% -4d: %016x != %016x", i, got, exp) } if got := HashString(string(buf[:i])); got != exp { t.Fatalf("% -4d: %016x != %016x", i, got, exp) } // NEW: h := New() h.Write(buf[:i]) if got := h.Sum64(); got != exp { t.Fatalf("% -4d: %016x != %016x", i, got, exp) } h.Reset() h.WriteString(string(buf[:i])) if got := h.Sum64(); got != exp { t.Fatalf("% -4d: %016x != %016x", i, got, exp) } } }
Produces output:
=== RUN TestCompatWithC_XXH3_64bits compat_test.go:20: 1089: 9ac8e74b6ae33cfe != e6b8f8f8df938429 --- FAIL: TestCompatWithC_XXH3_64bits (0.00s)
TestHasherCompat also fails if you change the input to be buf[i] = byte((i + 1) % 251). Strange.
TestHasherCompat
buf[i] = byte((i + 1) % 251)
Changing the
TestCompatWithC_XXH3_64bits
to the following produces mismatch after 1088 bytes:Produces output: