prysm-pulse/cache/lru/lru_wrpr_test.go
2021-09-14 18:11:25 -05:00

38 lines
670 B
Go

package lru
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNew(t *testing.T) {
assert.NotPanics(t, func() {
New(10)
})
}
func TestNew_ZeroOrNegativeSize(t *testing.T) {
assert.Panics(t, func() {
New(0)
})
assert.Panics(t, func() {
New(-1)
})
}
func TestNewWithEvict(t *testing.T) {
assert.NotPanics(t, func() {
NewWithEvict(10, func(key interface{}, value interface{}) {})
})
}
func TestNewWithEvict_ZeroOrNegativeSize(t *testing.T) {
assert.Panics(t, func() {
NewWithEvict(0, func(key interface{}, value interface{}) {})
})
assert.Panics(t, func() {
NewWithEvict(-1, func(key interface{}, value interface{}) {})
})
}