2014-03-18 23:38:06 -07:00
|
|
|
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()
|
2014-03-31 21:15:34 -07:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|