test_util

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BlsOptional = 0
	BlsRequired = 1
	BlsIgnored  = 2
)

Variables

View Source
var AllForks = []ForkName{"phase0", "altair", "bellatrix", "capella", "deneb"}

Functions

func Check added in v0.8.2

func Check(t *testing.T, err error)

func CompareStates added in v0.12.1

func CompareStates(spec *common.Spec, a common.BeaconState, b common.BeaconState) (diff string, err error)

func LoadSSZ added in v0.8.2

func LoadSSZ(t *testing.T, name string, dst codec.Deserializable, readPart TestPartReader) bool

func LoadSpecObj added in v0.12.2

func LoadSpecObj(t *testing.T, name string, dst common.SpecObj, readPart TestPartReader) bool

func LoadState added in v0.12.1

func LoadState(t *testing.T, fork ForkName, name string, readPart TestPartReader) common.BeaconState

func RunHandler added in v0.8.2

func RunHandler(t *testing.T, handlerPath string, caseRunner CaseRunner, spec *common.Spec, fork ForkName)

func RunTransitionTest added in v0.8.2

func RunTransitionTest(t *testing.T, forks []ForkName, runnerName string, handlerName string, mkr TransitionCaseMaker)

Types

type BLSMeta added in v0.8.2

type BLSMeta struct {
	BlsSetting int `yaml:"bls_setting"`
}

type BaseTransitionTest added in v0.8.2

type BaseTransitionTest struct {
	Spec *common.Spec
	Fork ForkName
	Pre  common.BeaconState
	Post common.BeaconState
}

func (*BaseTransitionTest) Check added in v0.8.2

func (c *BaseTransitionTest) Check(t *testing.T)

func (*BaseTransitionTest) ExpectingFailure added in v0.8.2

func (c *BaseTransitionTest) ExpectingFailure() bool

func (*BaseTransitionTest) Load added in v0.8.2

func (c *BaseTransitionTest) Load(t *testing.T, forkName ForkName, readPart TestPartReader)

type BlocksCountMeta added in v0.20.0

type BlocksCountMeta struct {
	BlocksCount uint64 `yaml:"blocks_count"`
}

type BlocksTestCase added in v0.20.0

type BlocksTestCase struct {
	BaseTransitionTest
	Blocks []*common.BeaconBlockEnvelope
}

func (*BlocksTestCase) Load added in v0.20.0

func (c *BlocksTestCase) Load(t *testing.T, forkName ForkName, readPart TestPartReader)

func (*BlocksTestCase) Run added in v0.20.0

func (c *BlocksTestCase) Run() error

type CaseRunner added in v0.8.2

type CaseRunner func(t *testing.T, forkName ForkName, readPart TestPartReader)

Runs a test case

func HandleBLS added in v0.8.2

func HandleBLS(testRunner CaseRunner) CaseRunner

type ForkName added in v0.16.0

type ForkName string

Fork where the test is organized, and thus the state/block/etc. types default to.

type TestPart added in v0.8.2

type TestPart interface {
	io.Reader
	io.Closer
	Exists() bool
}

type TestPartReader added in v0.8.2

type TestPartReader interface {
	Part(name string) TestPart
	Spec() *common.Spec
}

type TransitionCaseMaker added in v0.8.2

type TransitionCaseMaker func() TransitionTest

type TransitionTest added in v0.8.2

type TransitionTest interface {
	Load(t *testing.T, forkName ForkName, readPart TestPartReader)
	ExpectingFailure() bool
	Run() error
	Check(t *testing.T)
}

Jump to

Keyboard shortcuts

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