add fnv1a example

This commit is contained in:
Michael McLoughlin
2018-12-13 00:18:44 -08:00
parent b89d211ff4
commit 93b53377ac
8 changed files with 124 additions and 14 deletions

View File

@@ -0,0 +1,20 @@
package fnv1a
import (
"hash/fnv"
"testing"
"testing/quick"
)
//go:generate go run asm.go -out fnv1a.s -stubs stub.go
func TestHash64(t *testing.T) {
expect := func(data []byte) uint64 {
h := fnv.New64a()
h.Write(data)
return h.Sum64()
}
if err := quick.CheckEqual(Hash64, expect, nil); err != nil {
t.Fatal(err)
}
}