tile38/vendor/github.com/nats-io/nuid/unique_test.go

20 lines
284 B
Go
Raw Permalink Normal View History

2018-08-07 22:24:46 +03:00
// +build !race
package nuid
import (
"testing"
)
func TestBasicUniqueness(t *testing.T) {
n := 10000000
m := make(map[string]struct{}, n)
for i := 0; i < n; i++ {
n := Next()
if _, ok := m[n]; ok {
t.Fatalf("Duplicate NUID found: %v\n", n)
}
m[n] = struct{}{}
}
}