You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
297B

  1. package botserv
  2. import (
  3. "testing"
  4. )
  5. func TestIDGenerator(t *testing.T) {
  6. cache := make(map[string]bool)
  7. var cur string
  8. gg := NewIdGenerator()
  9. for i := 0; i < 10000; i++ {
  10. cur = gg.Hash()
  11. if _, ok := cache[cur]; ok {
  12. t.Errorf("unexpected duplicate key")
  13. }
  14. cache[cur] = true
  15. }
  16. }