spectest

package
v0.0.0-...-1f8a15b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreSsz   = "pre.ssz_snappy"
	PostSsz  = "post.ssz_snappy"
	MetaYaml = "meta.yaml"
)

Variables

View Source
var ErrorHandlerNotFound = errors.New("handler not found")
View Source
var ErrorHandlerNotImplemented = errors.New("handler not implemented")
View Source
var UnimplementedHandler = HandlerFunc(func(t *testing.T, root fs.FS, c TestCase) (err error) {
	t.Skipf("Handler not implemented: %s/%s", c.RunnerName, c.HandlerName)
	return nil
})

Functions

func ErrHandlerNotFound

func ErrHandlerNotFound(handler string) error

func ErrHandlerNotImplemented

func ErrHandlerNotImplemented(handler string) error

func ReadAnchorBlock

func ReadAnchorBlock(root fs.FS, version clparams2.StateVersion, name string) (*cltypes.BeaconBlock, error)

func ReadBeaconState

func ReadBeaconState(root fs.FS, version clparams2.StateVersion, name string) (*state.CachingBeaconState, error)

func ReadBlock

func ReadBlock(root fs.FS, version clparams2.StateVersion, index int) (*cltypes.SignedBeaconBlock, error)

func ReadBlockSlot

func ReadBlockSlot(root fs.FS, index int) (uint64, error)

func ReadBlocks

func ReadBlocks(root fs.FS, version clparams2.StateVersion) ([]*cltypes.SignedBeaconBlock, error)

func ReadMeta

func ReadMeta(root fs.FS, name string, obj any) error

func ReadSsz

func ReadSsz(root fs.FS, version clparams2.StateVersion, name string, obj ssz.Unmarshaler) error

func ReadSszOld

func ReadSszOld(root fs.FS, obj ssz.Unmarshaler, version clparams2.StateVersion, name string) error

func ReadYml

func ReadYml(root fs.FS, name string, obj any) error

func RunCases

func RunCases(t *testing.T, app Appendix, machineImpl machine.Interface, root fs.FS)

Types

type Appendix

type Appendix map[string]*Format

func (Appendix) Add

func (a Appendix) Add(name string) *Format

type Format

type Format struct {
	// contains filtered or unexported fields
}

func NewFormat

func NewFormat() *Format

func (*Format) GetHandler

func (r *Format) GetHandler(name string) (Handler, error)

func (*Format) GetHandlers

func (r *Format) GetHandlers() []string

func (*Format) With

func (r *Format) With(name string, handler Handler) *Format

func (*Format) WithFn

func (r *Format) WithFn(name string, handler HandlerFunc) *Format

type Handler

type Handler interface {
	Run(t *testing.T, root fs.FS, c TestCase) (err error)
}

type HandlerFunc

type HandlerFunc func(t *testing.T, root fs.FS, c TestCase) (err error)

func (HandlerFunc) Run

func (h HandlerFunc) Run(t *testing.T, root fs.FS, c TestCase) (err error)

type RunDirectoryOptions

type RunDirectoryOptions struct {
	FS fs.FS
}

type TestCase

type TestCase struct {
	ConfigName    string
	ForkPhaseName string
	RunnerName    string
	HandlerName   string
	SuiteName     string
	CaseName      string

	Machine machine.Interface
}

func (*TestCase) Version

func (t *TestCase) Version() clparams.StateVersion

type TestCases

type TestCases struct {
	// contains filtered or unexported fields
}

func ReadTestCases

func ReadTestCases(root fs.FS) (out *TestCases, err error)

func (*TestCases) Filter

func (t *TestCases) Filter(fn func(t TestCase) bool) *TestCases

func (*TestCases) Slice

func (t *TestCases) Slice() []TestCase

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL