server/id_test.go

20 lines
310 B
Go

package botserv
import (
"testing"
)
func TestIDGenerator(t *testing.T) {
cache := make(map[string]bool)
var cur string
gg := NewIdGenerator()
go gg.Run()
for i := 0; i < 10000; i++ {
cur = gg.Hash()
if _, ok := cache[cur]; ok {
t.Errorf("unexpected duplicate key")
}
cache[cur] = true
}
}