server/id_test.go

19 lines
294 B
Go

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