The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/internal/utils/lrucache/lrucache_test.go

29 lines
339 B

package lrucache
import (
"testing"
1 year ago
"github.com/stretchr/testify/require"
)
func TestKeys(t *testing.T) {
c := NewCache[int, int](10)
for i := 0; i < 3; i++ {
c.Set(i, i)
}
m := map[int]int{
0: 0,
1: 1,
2: 2,
}
keys := c.Keys()
m2 := map[int]int{}
for _, k := range keys {
m2[k] = k
}
require.Equal(t, m, m2)
}