(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestHashCollision(t *testing.T) { |
| 14 | var m = map[uint64]zero.Zero{} |
| 15 | |
| 16 | var count = 1_000 |
| 17 | if testutils.IsSingleTesting() { |
| 18 | count = 100_000_000 |
| 19 | } |
| 20 | |
| 21 | for i := 0; i < count; i++ { |
| 22 | var k = ttlcache.HashKeyString(strconv.Itoa(i)) |
| 23 | _, ok := m[k] |
| 24 | if ok { |
| 25 | t.Fatal("collision at", i) |
| 26 | } |
| 27 | m[k] = zero.New() |
| 28 | } |
| 29 | |
| 30 | t.Log(len(m), "elements") |
| 31 | } |
| 32 | |
| 33 | func BenchmarkHashKey_Bytes(b *testing.B) { |
| 34 | runtime.GOMAXPROCS(1) |
nothing calls this directly
no test coverage detected