diff --git a/lru_cache_test.go b/lru_cache_test.go index 1d403b2..1a02830 100644 --- a/lru_cache_test.go +++ b/lru_cache_test.go @@ -139,6 +139,27 @@ func TestCopyTo_LRU(t *testing.T) { func TestKeys_LRU(t *testing.T) { c := NewLRU[string, string](10) + c.Set("key1", "value1") + c.Set("key2", "value2") + c.Set("key3", "value3") + c.Set("key4", "value4") + c.Set("key5", "value5") + c.SetWithTimeout("key6", "value6", 1) + c.SetWithTimeout("key7", "value7", 1) + c.SetWithTimeout("key8", "value8", 1) + c.SetWithTimeout("key9", "value9", 1) + c.Set("key10", "value10") + + keys := c.Keys() + + if len(keys) != 6 { + t.Errorf("Keys failed") + } +} + +func TestAllKeys_LRU(t *testing.T) { + c := NewLRU[string, string](10) + c.Set("key1", "value1") c.Set("key2", "value2") c.Set("key3", "value3")