learning category repo

This commit is contained in:
Aleksandr Trushkin
2024-03-16 17:44:43 +03:00
parent 938d3cd307
commit 88a3cae4fa
13 changed files with 506 additions and 45 deletions

View File

@ -0,0 +1,23 @@
package xslices
import "testing"
func TestLRU(t *testing.T) {
lru := NewLRU[int, string](3)
for i := 0; i < 4; i++ {
lru.Push(i, "v")
}
for i := 0; i < 4; i++ {
_, found := lru.Get(i)
if i == 0 {
if found {
t.Error("expected value to be flushed out of cache")
}
continue
}
if !found {
t.Errorf("expected value %d to be found", i)
}
}
}