add fnv1a example
This commit is contained in:
20
examples/fnv1a/fnv_test.go
Normal file
20
examples/fnv1a/fnv_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user