go/src/hash/maphash/smhasher_test.go

var fixedSeed

// Sanity checks.
// hash should not depend on values outside key.
// hash should not depend on alignment.
func TestSmhasherSanity(t *testing.T) {}

func bytesHash(b []byte) uint64 {}

func stringHash(s string) uint64 {}

const hashSize

func randBytes(r *rand.Rand, b []byte) {}

type hashSet

func newHashSet() *hashSet {}

func (s *hashSet) add(h uint64) {}

func (s *hashSet) addS(x string) {}

func (s *hashSet) addB(x []byte) {}

func (s *hashSet) addS_seed(x string, seed Seed) {}

func (s *hashSet) check(t *testing.T) {}

// a string plus adding zeros must make distinct hashes
func TestSmhasherAppendedZeros(t *testing.T) {}

// All 0-3 byte strings have distinct hashes.
func TestSmhasherSmallKeys(t *testing.T) {}

// Different length strings of all zeros have distinct hashes.
func TestSmhasherZeros(t *testing.T) {}

// Strings with up to two nonzero bytes all have distinct hashes.
func TestSmhasherTwoNonzero(t *testing.T) {}

func twoNonZero(h *hashSet, n int) {}

// Test strings with repeats, like "abcdabcdabcdabcd..."
func TestSmhasherCyclic(t *testing.T) {}

// Test strings with only a few bits set
func TestSmhasherSparse(t *testing.T) {}

func sparse(t *testing.T, h *hashSet, n int, k int) {}

// set up to k bits at index i and greater
func setbits(h *hashSet, b []byte, i int, k int) {}

// Test all possible combinations of n blocks from the set s.
// "permutation" is a bad name here, but it is what Smhasher uses.
func TestSmhasherPermutation(t *testing.T) {}

func permutation(t *testing.T, h *hashSet, s []uint32, n int) {}

func genPerm(h *hashSet, b []byte, s []uint32, n int) {}

type key

type bytesKey

func (k *bytesKey) clear() {}

func (k *bytesKey) random(r *rand.Rand) {}

func (k *bytesKey) bits() int {}

func (k *bytesKey) flipBit(i int) {}

func (k *bytesKey) hash() uint64 {}

func (k *bytesKey) name() string {}

// Flipping a single bit of a key should flip each output bit with 50% probability.
func TestSmhasherAvalanche(t *testing.T) {}

func avalancheTest1(t *testing.T, k key) {}

// All bit rotations of a set of distinct keys
func TestSmhasherWindowed(t *testing.T) {}

func windowed(t *testing.T, k key) {}

// All keys of the form prefix + [A-Za-z0-9]*N + suffix.
func TestSmhasherText(t *testing.T) {}

func text(t *testing.T, h *hashSet, prefix, suffix string) {}

// Make sure different seed values generate different hashes.
func TestSmhasherSeed(t *testing.T) {}