A simple ID Generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
idg/id_test.go

19 lines
302 B

package idg
import (
"testing"
)
func TestGenerator(t *testing.T) {
cache := make(map[string]bool)
var cur string
gg := NewGenerator()
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
}
}