func TestNewCustomUint64NonDuplicateIdMultipleThreads(t *testing.T) {
	t.Parallel()

	ids := make(chan uint64, 100_000)
	wg := &sync.WaitGroup{}
	wg.Add(10)

	// create config with default values
	c := NewUint64Config(defaultUint64ProcessBits, defaultUint64ServerBits, defaultUint64SequenceBits)

	for t := 0; t < 10; t++ {
		go func() {
			defer wg.Done()

			for i := uint64(0); i < 10_000; i++ {
				id := Uint64(i, 0, &c)

				ids <- id
			}
		}()
	}

	wg.Wait()
	close(ids)

	seen := make(map[uint64]struct{})

	for i := range ids {
		if _, ok := seen[i]; !ok {
			seen[i] = struct{}{}
		} else {
			t.Error("Duplicate Id found: ", i)
		}
	}
}
// TestNewCustomUint64ForDuplicateIdMultipleThreads tests CustomUint64 for any duplicate id.
TestNewCustomUint64ForDuplicateIdMultipleThreads tests CustomUint64 for any duplicate id.
// TestNewCustomUint64ForDuplicateIdMultipleThreads tests CustomUint64 for any duplicate id .
func TestNewCustomUint64NonDuplicateIdMultipleThreads(t *testing.T) {
	t.Parallel()
	ids := make(chan uint64, 100_000)
	wg := &sync.WaitGroup{}
	wg.Add(10)
	c := NewUint64Config(defaultUint64ProcessBits, defaultUint64ServerBits, defaultUint64SequenceBits)
	for t := 0; t < 10; t++ {
		go func() {
			defer wg.Done()
			for i := uint64(0); i < 10_000; i++ {
				id := Uint64(i, 0, &c)
				ids <- id
			}
		}()
	}
	wg.Wait()
	close(ids)
	seen := make(map[uint64]struct{})
	for i := range ids {
		if _, ok := seen[i]; !ok {
			seen[i] = struct{}{}
		} else {
			t.Error("Duplicate Id found: ", i)
		}
	}
}
func TestNewCustomUint64NonDuplicateIdMultipleThreads ( t * testing . T ) { t . Parallel ( ) ids := make ( chan uint64 , 100_000 ) wg := & sync . WaitGroup { } wg . Add ( 10 ) c := NewUint64Config ( defaultUint64ProcessBits , defaultUint64ServerBits , defaultUint64SequenceBits ) for t := 0 ; t < 10 ; t ++ { go func ( ) { defer wg . Done ( ) for i := uint64 ( 0 ) ; i < 10_000 ; i ++ { id := Uint64 ( i , 0 , & c ) ids <- id } } ( ) } wg . Wait ( ) close ( ids ) seen := make ( map [ uint64 ] struct { } ) for i := range ids { if _ , ok := seen [ i ] ; ! ok { seen [ i ] = struct { } { } } else { t . Error ( " " , i ) } } }
TestNewCustomUint64ForDuplicateIdMultipleThreads tests CustomUint64 for any duplicate id.
TestNewCustomUint64ForDuplicateIdMultipleThreads tests CustomUint64 for any duplicate id .
// create config with default values