Files
redis-go/lib/consistenthash/consistenthash_test.go
2021-05-02 18:48:44 +08:00

18 lines
308 B
Go

package consistenthash
import "testing"
func TestHash(t *testing.T) {
m := New(3, nil)
m.AddNode("a", "b", "c", "d")
if m.PickNode("zxc") != "a" {
t.Error("wrong answer")
}
if m.PickNode("123{abc}") != "b" {
t.Error("wrong answer")
}
if m.PickNode("abc") != "b" {
t.Error("wrong answer")
}
}