batch

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFail

func CheckFail(ctx *RunContext, res language.Status, group *problems.Group, testcase *problems.Testcase) error

func CheckOK

func CheckOK(ctx *RunContext, res language.Status, group *problems.Group, testcase *problems.Testcase) error

func Cleanup

func Cleanup(ctx *RunContext) error

func Init

func Init(*RunContext) error

func PrepareFiles

func PrepareFiles(ctx *CompileContext) (language.File, []language.File, error)

func Run

func Run(ctx *RunContext, group *problems.Group, testcase *problems.Testcase) (language.Status, error)

Types

type Batch

type Batch struct {
	PrepareFilesF func(*CompileContext) (language.File, []language.File, error)

	InitF      func(*RunContext) error
	RunF       func(*RunContext, *problems.Group, *problems.Testcase) (language.Status, error)
	CheckOKF   func(*RunContext, language.Status, *problems.Group, *problems.Testcase) error
	CheckFailF func(*RunContext, language.Status, *problems.Group, *problems.Testcase) error
	CleanupF   func(*RunContext) error
}

func New

func New() Batch

func (Batch) Compile

func (b Batch) Compile(jinfo problems.Judgeable, sandbox language.Sandbox, lang language.Language, src io.Reader, dest io.Writer) (io.Reader, error)

func (Batch) Name

func (b Batch) Name() string

func (Batch) Run

func (b Batch) Run(judging problems.Judgeable, sp *language.SandboxProvider, lang language.Language, bin io.Reader, testNotifier chan string, statusNotifier chan problems.Status) (problems.Status, error)

type CompileContext

type CompileContext struct {
	Problem problems.Judgeable
	Sandbox language.Sandbox
	Lang    language.Language
	Source  io.Reader
	Binary  io.Writer
}

type RunContext

type RunContext struct {
	Problem         problems.Judgeable
	SandboxProvider *language.SandboxProvider
	Sandbox         language.Sandbox
	Lang            language.Language
	Binary          []byte
	TestChan        chan string
	StatusChan      chan problems.Status
	Stdout          *bytes.Buffer

	Store map[string]interface{}
}

Jump to

Keyboard shortcuts

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