server/id_test.go

20 lines
310 B
Go
Raw Normal View History

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