MCPcopy Index your code
hub / github.com/mpolden/echoip / TestCacheDuplicate

Function TestCacheDuplicate

http/cache_test.go:48–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func 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
63func TestCacheResize(t *testing.T) {
64 c := NewCache(10)

Callers

nothing calls this directly

Calls 2

SetMethod · 0.95
NewCacheFunction · 0.85

Tested by

no test coverage detected