scencontroller

package
v0.0.0-...-ab10b8b Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultFileResolver

func NewDefaultFileResolver() *fr.DefaultFileResolver

NewDefaultFileResolver yields a new DefaultFileResolver instance. Reexported here to avoid having all external packages importing the parser. DefaultFileResolver is in parse for local tests only.

func ParseScenariosScenario

func ParseScenariosScenario(parser mjparse.Parser, scenFilePath string) (*mj.Scenario, error)

ParseScenariosScenario reads and parses a Scenarios scenario from a JSON file.

func ParseScenariosScenarioDefaultParser

func ParseScenariosScenarioDefaultParser(scenFilePath string) (*mj.Scenario, error)

ParseScenariosScenarioDefaultParser reads and parses a Scenarios scenario from a JSON file.

func WriteScenariosScenario

func WriteScenariosScenario(scenario *mj.Scenario, toPath string) error

WriteScenariosScenario exports a Scenarios scenario to a file, using the default formatting.

Types

type RunScenarioOptions

type RunScenarioOptions struct {
	ForceTraceGas bool
}

func DefaultRunScenarioOptions

func DefaultRunScenarioOptions() *RunScenarioOptions

type ScenarioExecutor

type ScenarioExecutor interface {
	// Reset clears state/world.
	Reset()

	// ExecuteScenario executes the scenario and checks if it passed. Failure is signaled by returning an error.
	// The FileResolver helps with resolving external steps.
	// TODO: group into a "execution context" param.
	ExecuteScenario(*mj.Scenario, fr.FileResolver) error
}

ScenarioExecutor describes a component that can run a VM scenario.

type ScenarioRunner

type ScenarioRunner struct {
	Executor    ScenarioExecutor
	RunsNewTest bool
	Parser      mjparse.Parser
}

ScenarioRunner is a component that can run json scenarios, using a provided executor.

func NewScenarioRunner

func NewScenarioRunner(executor ScenarioExecutor, fileResolver fr.FileResolver) *ScenarioRunner

NewScenarioRunner creates new ScenarioRunner instance.

func (*ScenarioRunner) RunAllJSONScenariosInDirectory

func (r *ScenarioRunner) RunAllJSONScenariosInDirectory(
	generalTestPath string,
	specificTestPath string,
	allowedSuffix string,
	excludedFilePatterns []string,
	options *RunScenarioOptions) error

RunAllJSONScenariosInDirectory walks directory, parses and prepares all json scenarios, then calls scenarioExecutor for each of them.

func (*ScenarioRunner) RunSingleJSONScenario

func (r *ScenarioRunner) RunSingleJSONScenario(contextPath string, options *RunScenarioOptions) error

RunSingleJSONScenario parses and prepares test, then calls testCallback.

type TestExecutor

type TestExecutor interface {
	// ExecuteTest executes the test and checks if it passed. Failure is signaled by returning an error.
	ExecuteTest(*mj.Test) error
}

TestExecutor describes a component that can run a VM test.

type TestRunner

type TestRunner struct {
	Executor TestExecutor
	Parser   mjparse.Parser
}

TestRunner is a component that can run tests, using a provided executor.

func NewTestRunner

func NewTestRunner(executor TestExecutor, fileResolver fr.FileResolver) *TestRunner

NewTestRunner creates new TestRunner instance.

func (*TestRunner) RunAllJSONTestsInDirectory

func (r *TestRunner) RunAllJSONTestsInDirectory(
	generalTestPath string,
	specificTestPath string,
	allowedSuffix string,
	excludedFilePatterns []string) error

RunAllJSONTestsInDirectory walks directory, parses and prepares all json tests, then calls testExecutor for each of them.

func (*TestRunner) RunSingleJSONTest

func (r *TestRunner) RunSingleJSONTest(contextPath string) error

RunSingleJSONTest parses and prepares test, then calls testCallback.

Jump to

Keyboard shortcuts

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