examples/stadtx: commit first working example
This commit is contained in:
25
examples/stadtx/stadtx_test.go
Normal file
25
examples/stadtx/stadtx_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package stadtx
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"testing/quick"
|
||||
|
||||
ref "github.com/dgryski/go-stadtx"
|
||||
)
|
||||
|
||||
//go:generate go run asm.go -out stadtx.s -stubs stub.go
|
||||
|
||||
func IUT(s State, key []byte) uint64 {
|
||||
return Hash(&s, key)
|
||||
}
|
||||
|
||||
func Expect(s State, key []byte) uint64 {
|
||||
t := ref.State(s)
|
||||
return ref.Hash(&t, key)
|
||||
}
|
||||
|
||||
func TestCmp(t *testing.T) {
|
||||
if err := quick.CheckEqual(IUT, Expect, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user