mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
5a66807989
* First take at updating everything to v5 * Patch gRPC gateway to use prysm v5 Fix patch * Update go ssz --------- Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
26 lines
641 B
Go
26 lines
641 B
Go
package das
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
|
)
|
|
|
|
func TestCacheEnsureDelete(t *testing.T) {
|
|
c := newCache()
|
|
require.Equal(t, 0, len(c.entries))
|
|
root := bytesutil.ToBytes32([]byte("root"))
|
|
slot := primitives.Slot(1234)
|
|
k := cacheKey{root: root, slot: slot}
|
|
entry := c.ensure(k)
|
|
require.Equal(t, 1, len(c.entries))
|
|
require.Equal(t, c.entries[k], entry)
|
|
|
|
c.delete(k)
|
|
require.Equal(t, 0, len(c.entries))
|
|
var nilEntry *cacheEntry
|
|
require.Equal(t, nilEntry, c.entries[k])
|
|
}
|