Documentation ¶
Overview ¶
Package problems contains utilities useful for parsing, displaying, judging (submission for) problems
Index ¶
- Variables
- func DeregisterConfigType(name string) error
- func RegisterConfigType(name string, parser ConfigParser, identifier ConfigIdentifier) error
- func RegisterTaskType(taskType TaskType)
- func Truncate(s string) string
- type Attachments
- type BytesData
- func (s BytesData) IsHTML() bool
- func (s BytesData) IsPDF() bool
- func (s BytesData) IsText() bool
- func (s BytesData) Locale() string
- func (s BytesData) Name() string
- func (s BytesData) String() string
- func (s BytesData) Type() string
- func (s BytesData) Value() ([]byte, error)
- func (s BytesData) ValueReader() (io.ReadCloser, error)
- type Checker
- type ConfigIdentifier
- type ConfigList
- type ConfigParser
- type ConfigStore
- type Contents
- type Data
- type FeedbackType
- type File
- type FsStore
- type FsStoreOptions
- type Group
- type Judgeable
- type LocalizedData
- type NamedData
- type Problem
- type ProblemConfigType
- type ProblemNotFoundError
- type ProblemParseError
- type ProblemWrapper
- type ScoringType
- type Status
- type Store
- type TaskType
- type Testcase
- type Testset
- func (ts Testset) FirstNonAC() int
- func (ts Testset) IndexTestcase(ind int) *Testcase
- func (ts Testset) IsAC() bool
- func (ts Testset) MaxMemoryUsage() int
- func (ts Testset) MaxScore() (res float64)
- func (ts Testset) MaxTimeSpent() time.Duration
- func (ts Testset) Score() (res float64)
- func (ts *Testset) SetMemoryLimit(ml int)
- func (ts *Testset) SetTimeLimit(tl time.Duration)
- func (ts Testset) Testcases() (testcases []*Testcase)
- func (ts Testset) Verdict() VerdictName
- type VerdictName
Constants ¶
This section is empty.
Variables ¶
var ( ErrorNameUsed = errors.New("config type name already in use") ErrorNoMatch = errors.New("parser can't decide config type, no match") )
var ( DataTypeText = "text" DataTypeHTML = "text/html" DataTypePDF = "application/pdf" )
var ( FsStoreIgnoreFile = ".njudge_ignore" FsStorePrefixFile = ".njudge_prefix" )
var ErrorProblemNotFound = errors.New("problem not found")
var ErrorProblemParse = errors.New("can't parse problems")
Functions ¶
func DeregisterConfigType ¶
DeregisterConfigType unregisters a config type to the global ConfigStore
func RegisterConfigType ¶
func RegisterConfigType(name string, parser ConfigParser, identifier ConfigIdentifier) error
RegisterConfigType registers a config type to the global ConfigStore
func RegisterTaskType ¶
func RegisterTaskType(taskType TaskType)
Types ¶
type Attachments ¶
type Attachments []NamedData
type BytesData ¶
type BytesData struct { Loc string //Locale Val []byte //Value Typ string //Type (for example "text", "application/pdf", "text/html") Nam string //Name }
func (BytesData) ValueReader ¶
func (s BytesData) ValueReader() (io.ReadCloser, error)
type ConfigIdentifier ¶
ConfigIdentifier is a function for some config type which takes a path and returns true if it thinks that its respective parser can parse it
type ConfigList ¶
type ConfigList struct {
ConfigTypes []ProblemConfigType
}
func NewConfigList ¶
func NewConfigList() *ConfigList
NewConfigList returns the default implementation of ConfigStore
func (*ConfigList) Deregister ¶
func (cs *ConfigList) Deregister(name string) error
func (*ConfigList) Register ¶
func (cs *ConfigList) Register(name string, parser ConfigParser, identifier ConfigIdentifier) error
type ConfigParser ¶
ConfigParser is a function for some config type which parses the problem from some path provided to it
type ConfigStore ¶
type ConfigStore interface { Register(string, ConfigParser, ConfigIdentifier) error Deregister(string) error Parse(afero.Fs, string) (Problem, error) }
ConfigStore is an interface with which you can register/deregister certain config types and parse a problem using these config types
type Contents ¶
type Contents []LocalizedData
func (Contents) FilterByLocale ¶
func (Contents) FilterByType ¶
type FeedbackType ¶
type FeedbackType int
FeedbackType is mainly for displaying to the end user. In FeedbackCF we actually output the contestant's output and the jury's output, too whereas in for example FeedbackACM we only use standard ACM feedback (just the verdict), in FeedbackIOI we display all testcases along information about groups.
const ( FeedbackCF FeedbackType = iota FeedbackIOI FeedbackACM FeedbackLazyIOI )
func FeedbackFromString ¶
func FeedbackFromString(str string) FeedbackType
FeedbackFromString parses a string into FeedbackType, the default is FEEDBACK_CF, "ioi" is for FeedbackIOI and "acm" is for FeedbackACM
func (FeedbackType) String ¶
func (f FeedbackType) String() string
type FsStore ¶
type FsStore struct { ByPath map[string]string sync.RWMutex // contains filtered or unexported fields }
func NewFsStore ¶
func NewFsStore(root string, options ...FsStoreOptions) *FsStore
type FsStoreOptions ¶
type FsStoreOptions func(*FsStore)
func FsStoreIgnorePrefix ¶
func FsStoreIgnorePrefix() FsStoreOptions
func FsStoreUseConfigStore ¶
func FsStoreUseConfigStore(cs ConfigStore) FsStoreOptions
func FsStoreUseFs ¶
func FsStoreUseFs(afs afero.Fs) FsStoreOptions
type Group ¶
type Group struct { Name string Scoring ScoringType Testcases []Testcase Dependencies []string }
A Group is named group of tests for which there is a scoring policy defined.
func (Group) FirstNonAC ¶
func (Group) MaxMemoryUsage ¶
func (Group) MaxTimeSpent ¶
func (*Group) SetMemoryLimit ¶
func (*Group) SetTimeLimit ¶
type LocalizedData ¶
type Problem ¶
type ProblemConfigType ¶
type ProblemConfigType struct { Name string Parser ConfigParser Identifier ConfigIdentifier }
type ProblemNotFoundError ¶
type ProblemNotFoundError struct {
Name string
}
func (ProblemNotFoundError) Error ¶
func (perr ProblemNotFoundError) Error() string
func (ProblemNotFoundError) Is ¶
func (perr ProblemNotFoundError) Is(target error) bool
type ProblemParseError ¶
func (ProblemParseError) Error ¶
func (perr ProblemParseError) Error() string
func (ProblemParseError) Is ¶
func (perr ProblemParseError) Is(target error) bool
type ProblemWrapper ¶
func (ProblemWrapper) Name ¶
func (pw ProblemWrapper) Name() string
type ScoringType ¶
type ScoringType int
ScoringType represents the scoring of a group of tests,
- ScoringGroup means that if there's a non-accepted (or partially accepted) testcase in the group then the whole group scores 0 points,
- ScoringSum means that the score of the group is the sum of scores of individual scores.
const ( ScoringGroup ScoringType = iota ScoringSum ScoringMin )
func ScoringFromString ¶
func ScoringFromString(str string) ScoringType
type Status ¶
type Status struct { Compiled bool CompilerOutput string FeedbackType FeedbackType Feedback []Testset }
A Status represents the status of a submission after judging It contains the information about compilation and the feedback The main Testset is always the first one in Feedback.
type Store ¶
type Store interface { List() ([]string, error) Has(string) (bool, error) Get(string) (Problem, error) MustGet(string) Problem Update() error UpdateProblem(path string, id string) error }
Store is an interface which is used to access a bunch of problems for example from the filesystem
type TaskType ¶
type TaskType interface { Name() string Compile(Judgeable, language.Sandbox, language.Language, io.Reader, io.Writer) (io.Reader, error) Run(Judgeable, *language.SandboxProvider, language.Language, io.Reader, chan string, chan Status) (Status, error) }
func GetTaskType ¶
type Testcase ¶
type Testcase struct { Index int InputPath string OutputPath string AnswerPath string Testset string Group string VerdictName VerdictName Score float64 MaxScore float64 Output string ExpectedOutput string CheckerOutput string TimeSpent time.Duration MemoryUsed int TimeLimit time.Duration MemoryLimit int }
Testcase represents a testcase in the status of a submission.
type Testset ¶
Testset represents some set of tests, for example pretests and system tests should be testsets. They can also be used to seamlessly rejudge for contestants.
func (Testset) FirstNonAC ¶
func (Testset) IndexTestcase ¶
func (Testset) MaxMemoryUsage ¶
func (Testset) MaxTimeSpent ¶
func (*Testset) SetMemoryLimit ¶
func (*Testset) SetTimeLimit ¶
func (Testset) Verdict ¶
func (ts Testset) Verdict() VerdictName
type VerdictName ¶
type VerdictName int
VerdictName represents the verdict of a testcase i.e the outcome which happened in result of running the testcase (or the lack of running it in the case of VerdictDR)
const ( VerdictAC VerdictName = iota VerdictWA VerdictRE VerdictTL VerdictML VerdictXX VerdictDR VerdictPC VerdictPE )
func (VerdictName) String ¶
func (v VerdictName) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package checker contains different implementation of the interface defined as github.com/mraron/njudge/pkg/problems.Checker
|
Package checker contains different implementation of the interface defined as github.com/mraron/njudge/pkg/problems.Checker |
config
|
|
tasktype
|
|