MCPcopy
hub / github.com/Velocidex/velociraptor / TestClear

Function TestClear

third_party/cache/lru_cache_test.go:207–218  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

205}
206
207func TestClear(t *testing.T) {
208 cache := NewLRUCache(100)
209 value := &CacheValue{1}
210 key := "key"
211
212 cache.Set(key, value)
213 cache.Clear()
214
215 if _, sz, _, _, _ := cache.StatsOld(); sz != 0 {
216 t.Errorf("cache.Size() = %v, expected 0 after Clear()", sz)
217 }
218}
219
220func TestCapacityIsObeyed(t *testing.T) {
221 size := int64(3)

Callers

nothing calls this directly

Calls 5

SetMethod · 0.95
ClearMethod · 0.95
StatsOldMethod · 0.95
NewLRUCacheFunction · 0.70
ErrorfMethod · 0.45

Tested by

no test coverage detected