Skip to content

Commit

Permalink
add TestKeys_LRU
Browse files Browse the repository at this point in the history
  • Loading branch information
knbr13 committed May 22, 2024
1 parent 64cb5d2 commit 3cc1889
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lru_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 3cc1889

Please sign in to comment.