specs

package
v0.0.0-...-acb1236 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPathParse = errors.New("spectest path not in expected format, could not parse identifiers")
View Source
var ErrUnknownFork = errors.New("unknown fork name")
View Source
var ErrUnknownPreset = errors.New("unknown preset name")
View Source
var ForkOrder = []Fork{Phase0, Altair, Bellatrix, Capella}

var ForkOrder = []Fork{Phase0, Altair, Bellatrix, Capella, EIP4844}

Functions

func DecodeRootFile

func DecodeRootFile(f []byte) ([32]byte, error)

func ExtractCases

func ExtractCases(tgz io.Reader, filter TestIdent) (map[TestIdent]Fixture, error)

func GroupByFork

func GroupByFork(cases map[TestIdent]Fixture) map[Fork][]TestIdent

func GroupByType

func GroupByType(ti []TestIdent) map[string][]TestIdent

func IdentFilter

func IdentFilter(ident TestIdent) func([]TestIdent) []TestIdent

func RootAndSerializedFromFixture

func RootAndSerializedFromFixture(dir string) ([32]byte, []byte, error)

func WriteSpecTestFiles

func WriteSpecTestFiles(cases map[TestIdent]Fixture, rels *SpecRelationships, fs afero.Fs) error

Types

type Fixture

type Fixture struct {
	Directory  string
	Root       FixtureFile
	Serialized FixtureFile
	Yaml       FixtureFile
}

type FixtureFile

type FixtureFile struct {
	Contents []byte
	FileMode os.FileMode
}

type Fork

type Fork string
var (
	ForkUnknown Fork = ""
	Phase0      Fork = "phase0"
	Altair      Fork = "altair"
	Bellatrix   Fork = "bellatrix"
	Capella     Fork = "capella"
)

func (*Fork) UnmarshalText

func (f *Fork) UnmarshalText(t []byte) error

type ForkTypeDefinitions

type ForkTypeDefinitions struct {
	Fork  Fork           `json:"fork"`
	Types []TypeRelation `json:"types"`
}

type Preset

type Preset string
var (
	PresetUnknown Preset = ""
	Minimal       Preset = "minimal"
	Mainnet       Preset = "mainnet"
)

func (*Preset) UnmarshalText

func (p *Preset) UnmarshalText(t []byte) error

type SpecRelationships

type SpecRelationships struct {
	Package string                `json:"package"`
	Preset  Preset                `json:"preset"`
	Defs    []ForkTypeDefinitions `json:"defs"`
}

func ParseConfigFile

func ParseConfigFile(path string) (*SpecRelationships, error)

func (SpecRelationships) GoTypes

func (sr SpecRelationships) GoTypes() []string

func (SpecRelationships) RelationsAtFork

func (sr SpecRelationships) RelationsAtFork(f Fork) (map[string]string, error)

type TestCaseTpl

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

func (*TestCaseTpl) FixtureDirectory

func (tpl *TestCaseTpl) FixtureDirectory() string

func (*TestCaseTpl) GoTypeName

func (tpl *TestCaseTpl) GoTypeName() string

func (*TestCaseTpl) Render

func (tpl *TestCaseTpl) Render() (string, error)

func (*TestCaseTpl) TestFuncName

func (tpl *TestCaseTpl) TestFuncName() string

type TestIdent

type TestIdent struct {
	Preset Preset `json:"preset"`
	Fork   Fork   `json:"fork"`
	Name   string `json:"name"`
	Offset int    `json:"offset"`
}

func ParsePath

func ParsePath(p string) (TestIdent, string, error)

func (TestIdent) LessThan

func (ti TestIdent) LessThan(other TestIdent) bool

func (TestIdent) Match

func (ti TestIdent) Match(other TestIdent) bool

func (TestIdent) String

func (ti TestIdent) String() string

type TypeRelation

type TypeRelation struct {
	SpecName string `json:"name"`
	TypeName string `json:"type_name"`
}

Jump to

Keyboard shortcuts

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