mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
38 lines
670 B
Go
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{}) {})
|
|
})
|
|
}
|