segmentio / fasthash

Go package porting the standard hashing algorithms to a more efficient implementation.
MIT License
286 stars 21 forks source link

Move testing utils into a sub package. #7

Closed f2prateek closed 6 years ago

f2prateek commented 6 years ago

This helps simplify the API, and seperates the library into two packages:

a) one for the core package.

package fasthash

func HashString32(f func() hash.Hash32) func(string) uint32
func HashString64(f func() hash.Hash64) func(string) uint64
func HashUint32(f func() hash.Hash32) func(uint32) uint32
func HashUint64(f func() hash.Hash64) func(uint64) uint64

b) one for testing.

package fasthashtest

func BenchmarkHashString32(b *testing.B, name string, reference func(string) uint32, algorithm func(string) uint32)
func BenchmarkHashString64(b *testing.B, name string, reference func(string) uint64, algorithm func(string) uint64)
func TestHashString32(t *testing.T, name string, reference func(string) uint32, algorithm func(string) uint32)
func TestHashString64(t *testing.T, name string, reference func(string) uint64, algorithm func(string) uint64)
func TestHashUint32(t *testing.T, name string, reference func(uint32) uint32, algorithm func(uint32) uint32)
func TestHashUint64(t *testing.T, name string, reference func(uint64) uint64, algorithm func(uint64) uint64)

Closes #6.