added code

This commit is contained in:
sm
2014-08-03 01:02:16 -07:00
parent ffcf226edf
commit 4b5793ee6d
2 changed files with 62 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package idg
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
}
}