(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestCacheDuplicate(t *testing.T) { |
| 49 | c := NewCache(10) |
| 50 | ip := net.ParseIP("192.0.2.1") |
| 51 | response := Response{IP: ip} |
| 52 | c.Set(ip, response) |
| 53 | c.Set(ip, response) |
| 54 | want := 1 |
| 55 | if got := len(c.entries); got != want { |
| 56 | t.Errorf("want %d entries, got %d", want, got) |
| 57 | } |
| 58 | if got := c.values.Len(); got != want { |
| 59 | t.Errorf("want %d values, got %d", want, got) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestCacheResize(t *testing.T) { |
| 64 | c := NewCache(10) |