MCPcopy Index your code
hub / github.com/golang/groupcache / TestConsistency

Function TestConsistency

consistenthash/consistenthash_test.go:68–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestConsistency(t *testing.T) {
69 hash1 := New(1, nil)
70 hash2 := New(1, nil)
71
72 hash1.Add("Bill", "Bob", "Bonny")
73 hash2.Add("Bob", "Bonny", "Bill")
74
75 if hash1.Get("Ben") != hash2.Get("Ben") {
76 t.Errorf("Fetching 'Ben' from both hashes should be the same")
77 }
78
79 hash2.Add("Becky", "Ben", "Bobby")
80
81 if hash1.Get("Ben") != hash2.Get("Ben") ||
82 hash1.Get("Bob") != hash2.Get("Bob") ||
83 hash1.Get("Bonny") != hash2.Get("Bonny") {
84 t.Errorf("Direct matches should always return the same entry")
85 }
86
87}
88
89func BenchmarkGet8(b *testing.B) { benchmarkGet(b, 8) }
90func BenchmarkGet32(b *testing.B) { benchmarkGet(b, 32) }

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
GetMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…