test

package
v0.0.0-...-5733806 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadTestFile = kilonova.Statusf(400, "Bad test score file")
	ErrBadArchive  = kilonova.Statusf(400, "Bad archive")
)
View Source
var (
	ErrInvalidTestID = kilonova.Statusf(400, "Invalid test ID")
)

Functions

func ProcessArchiveFile

func ProcessArchiveFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

func ProcessAttachmentFile

func ProcessAttachmentFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

func ProcessPolygonCheckFile

func ProcessPolygonCheckFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

func ProcessProblemXMLFile

func ProcessProblemXMLFile(actx *ArchiveCtx, file io.Reader) *kilonova.StatusError

func ProcessPropertiesFile

func ProcessPropertiesFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

TODO: Allow having multiple .properties files And split grader.properties from generator.go into multiple files

func ProcessSubmissionFile

func ProcessSubmissionFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

func ProcessTestInputFile

func ProcessTestInputFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

func ProcessTestOutputFile

func ProcessTestOutputFile(ctx *ArchiveCtx, file *zip.File) *kilonova.StatusError

func ProcessZipTestArchive

func ProcessZipTestArchive(ctx context.Context, pb *kilonova.Problem, ar *zip.Reader, base *sudoapi.BaseAPI, params *TestProcessParams) *kilonova.StatusError

Types

type ArchiveCtx

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

func NewArchiveCtx

func NewArchiveCtx(params *TestProcessParams) *ArchiveCtx

type ArchiveGenOptions

type ArchiveGenOptions struct {
	Tests bool `json:"tests"`

	Attachments bool `json:"attachments"`
	// If PrivateAttachments is true, the generator also adds attachments marked private
	// It's an option since non-editors should not be able to download private attachments.
	PrivateAttachments bool `json:"private_attachments"`

	// ProblemDetails includes problem metadata such as time/memory limits, problem name, whether it's console input, etc
	ProblemDetails bool `json:"details"`
	// Tags also adds tag list in a safe format
	Tags bool `json:"tags"`

	// Editors also includes a list of editor usernames
	Editors bool `json:"editors"`

	// Submissions only includes submissions from the problem editors,
	// whereas AllSubmissions includes ALL submissions
	Submissions     bool                `json:"submissions"`
	AllSubmissions  bool                `json:"all_submissions"`
	SubsLook        bool                `json:"-"`
	SubsLookingUser *kilonova.UserBrief `json:"-"`
}

type PropertiesRaw

type PropertiesRaw struct {
	Groups       string   `props:"groups"`
	Weights      string   `props:"weights"`
	Dependencies string   `props:"dependencies"`
	Time         *float64 `props:"time"`
	Memory       *float64 `props:"memory"`
	Tags         *string  `props:"tags"`
	Source       *string  `props:"source"`
	ConsoleInput *string  `props:"console_input"`
	TestName     *string  `props:"test_name"`
	ProblemName  *string  `props:"problem_name"`

	Editors *string `props:"editors"`

	DefaultScore *string `props:"default_score"`

	ScorePrecision  *int32  `props:"score_precision"`
	ScoringStrategy *string `props:"scoring_strategy"`
}

func ParsePropertiesFile

func ParsePropertiesFile(r io.Reader) (*PropertiesRaw, bool, error)

type ScoreFileEntries

type ScoreFileEntries = map[int]decimal.Decimal

TestID -> Score

func ParseScoreFile

func ParseScoreFile(file *zip.File) (ScoreFileEntries, *kilonova.StatusError)

type ScoreParamEntry

type ScoreParamEntry struct {
	Score decimal.Decimal

	Count *int
	Match *regexp.Regexp
}

func ParseScoreParameters

func ParseScoreParameters(params []byte) ([]ScoreParamEntry, *kilonova.StatusError)

func (*ScoreParamEntry) UnmarshalJSON

func (p *ScoreParamEntry) UnmarshalJSON(input []byte) error

func (ScoreParamEntry) Valid

func (p ScoreParamEntry) Valid() bool

type Subtask

type Subtask struct {
	Score decimal.Decimal
	Tests []int
}

type TestProcessParams

type TestProcessParams struct {
	Requestor *kilonova.UserBrief

	ScoreParamsStr string

	Polygon          bool
	MergeAttachments bool
}

Jump to

Keyboard shortcuts

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