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.
28 lines
338 B
28 lines
338 B
1 year ago
|
package lrucache
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/require"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
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)
|
||
|
}
|