 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func RunEqualTests(t *testing.T, tests map[string]ConfigEqualTest)
- func RunPrecompileBenchmarks(b *testing.B, module modules.Module, tests []PrecompileTest)
- func RunPrecompileTests(t *testing.T, module modules.Module, tests []PrecompileTest)
- func RunPredicateBenchmarks(b *testing.B, tests []PredicateTest)
- func RunPredicateTests(t *testing.T, tests []PredicateTest)
- func RunVerifyTests(t *testing.T, tests map[string]ConfigVerifyTest)
- type ConfigEqualTest
- type ConfigVerifyTest
- type PrecompileRunparams
- type PrecompileTest
- type PredicateTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunEqualTests ¶
func RunEqualTests(t *testing.T, tests map[string]ConfigEqualTest)
func RunPrecompileBenchmarks ¶
func RunPrecompileBenchmarks(b *testing.B, module modules.Module, tests []PrecompileTest)
func RunPrecompileTests ¶
func RunPrecompileTests(t *testing.T, module modules.Module, tests []PrecompileTest)
func RunPredicateBenchmarks ¶
func RunPredicateBenchmarks(b *testing.B, tests []PredicateTest)
func RunPredicateTests ¶
func RunPredicateTests(t *testing.T, tests []PredicateTest)
func RunVerifyTests ¶
func RunVerifyTests(t *testing.T, tests map[string]ConfigVerifyTest)
Types ¶
type ConfigEqualTest ¶
type ConfigEqualTest struct {
	Config   precompileconfig.Config
	Other    precompileconfig.Config
	Expected bool
}
    ConfigEqualTest is a test case for comparing two configs
type ConfigVerifyTest ¶
type ConfigVerifyTest struct {
	Config        precompileconfig.Config
	ChainConfig   precompileconfig.ChainConfig
	ExpectedError string
}
    ConfigVerifyTest is a test case for verifying a config
type PrecompileRunparams ¶
type PrecompileTest ¶
type PrecompileTest struct {
	Name string
	// Caller is the address of the precompile caller
	Caller common.Address
	// Input the raw input bytes to the precompile
	Input []byte
	// InputFn is a function that returns the raw input bytes to the precompile
	// If specified, Input will be ignored.
	InputFn func(t testing.TB) []byte
	// SuppliedGas is the amount of gas supplied to the precompile
	SuppliedGas uint64
	// ReadOnly is whether the precompile should be called in read only
	// mode. If true, the precompile should not modify the state.
	ReadOnly bool
	// Config is the config to use for the precompile
	// It should be the same precompile config that is used in the
	// precompile's configurator.
	// If nil, Configure will not be called.
	Config precompileconfig.Config
	// BeforeHook is called before the precompile is called.
	BeforeHook func(t testing.TB, state *extstate.StateDB)
	// Predicates that the precompile should have access to.
	Predicates []predicate.Predicate
	// SetupBlockContext sets the expected calls on MockBlockContext for the test execution.
	SetupBlockContext func(*contract.MockBlockContext)
	// AfterHook is called after the precompile is called.
	AfterHook func(t testing.TB, state *extstate.StateDB)
	// ExpectedRes is the expected raw byte result returned by the precompile
	ExpectedRes []byte
	// ExpectedErr is the expected error returned by the precompile
	ExpectedErr string
	// ChainConfigFn returns the chain config to use for the precompile's block context
	// If nil, the default chain config will be used.
	ChainConfigFn func(*gomock.Controller) precompileconfig.ChainConfig
	// Rules is the rules to use for the precompile's block context
	Rules extras.AvalancheRules
}
    PrecompileTest is a test case for a precompile
type PredicateTest ¶
type PredicateTest struct {
	Name string
	Config precompileconfig.Config
	PredicateContext *precompileconfig.PredicateContext
	Predicate   predicate.Predicate
	Rules       precompileconfig.Rules
	Gas         uint64
	GasErr      error
	ExpectedErr error
}
    PredicateTest defines a unit test/benchmark for verifying a precompile predicate.
func (PredicateTest) Run ¶
func (test PredicateTest) Run(t testing.TB)
func (PredicateTest) RunBenchmark ¶
func (test PredicateTest) RunBenchmark(b *testing.B)
 Click to show internal directories. 
   Click to hide internal directories.