3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 03:02:48 +01:00
ergo/irc/client_test.go
2019-12-24 09:29:54 -05:00

30 lines
481 B
Go

// Copyright (c) 2019 Shivaram Lingamneni
// released under the MIT license
package irc
import (
"testing"
)
func TestGenerateBatchID(t *testing.T) {
var session Session
s := make(StringSet)
count := 100000
for i := 0; i < count; i++ {
s.Add(session.generateBatchID())
}
if len(s) != count {
t.Error("duplicate batch ID detected")
}
}
func BenchmarkGenerateBatchID(b *testing.B) {
var session Session
for i := 0; i < b.N; i++ {
session.generateBatchID()
}
}