您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

client_test.go 481B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) 2019 Shivaram Lingamneni
  2. // released under the MIT license
  3. package irc
  4. import (
  5. "testing"
  6. )
  7. func TestGenerateBatchID(t *testing.T) {
  8. var session Session
  9. s := make(StringSet)
  10. count := 100000
  11. for i := 0; i < count; i++ {
  12. s.Add(session.generateBatchID())
  13. }
  14. if len(s) != count {
  15. t.Error("duplicate batch ID detected")
  16. }
  17. }
  18. func BenchmarkGenerateBatchID(b *testing.B) {
  19. var session Session
  20. for i := 0; i < b.N; i++ {
  21. session.generateBatchID()
  22. }
  23. }