mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
02966e64d8
* Add Wrapper to LRU Cache to handle Invalid Parameters #9461 * Regenerate BUILD.bazel and simplify tests using lru.Cache * Fix: fuzz_exports.go build error * Fix: block_fuzz.go * Revert lru.Cache interface * Remove redundant err check in pending_attestations_queue_test.go * Add tests for lru wrapper * Use lru package in prysm/shared instead of lruwrpr * Fix: goimports * Fix: BUILD.bazel Co-authored-by: Nishant Das <nishdas93@gmail.com>
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{}) {})
|
|
})
|
|
}
|