package examples import ( "math/bits" unsafeRandom "math/rand/v2" "testing" ) func TestMul64(t *testing.T) { mul64, done, err := Mul64() if err != nil { t.Fatal(err) } defer done() for range 128 { a, b := unsafeRandom.Uint64(), unsafeRandom.Uint64() expectedHi, expectedLo := bits.Mul64(a, b) gotHi, gotLo := mul64(a, b) if expectedHi != gotHi || expectedLo != gotLo { t.Errorf("Mul64(%x, %x) = (%x %x), want (%x %x)", a, b, gotHi, gotLo, expectedHi, expectedLo) } } }