Documentation ¶
Overview ¶
Package internal contains internal logic of the application.
Package internal contains internal logic of the application.
Package internal contains internal logic of the application.
Package internal contains internal logic of the application.
Package internal contains internal logic of the application.
Index ¶
- Constants
- func AddRun(contest *ContestInfo, run *RunInfo)
- func GenerateContestInfo(config *config.Config) error
- func RejudgeRun(run *RunInfo) error
- func RemoveFile(path string)
- func UpdateContestInfo(config *config.Config, contest **ContestInfo)
- type CodeRunnerContext
- type ContestInfo
- type ContestantInfo
- type ProblemInfo
- type Run
- type RunInfo
- type TestResult
- type TestingResult
Constants ¶
const ( NONE = TestResult(iota) OK CE RE TL ML WA EOC )
Enum values
Variables ¶
This section is empty.
Functions ¶
func AddRun ¶
func AddRun(contest *ContestInfo, run *RunInfo)
AddRun adds new run for the current contest
func GenerateContestInfo ¶
GenerateContestInfo generates default contest info json file with the specified config
func UpdateContestInfo ¶
func UpdateContestInfo(config *config.Config, contest **ContestInfo)
UpdateContestInfo updates info about the current contest and writes it to the specified json file
Types ¶
type CodeRunnerContext ¶
type CodeRunnerContext struct {
// contains filtered or unexported fields
}
CodeRunnerContext is a struct that contains all necessary information for running tests.
func NewCodeRunnerContext ¶
func NewCodeRunnerContext(filePath, executablePath, language string) *CodeRunnerContext
NewCodeRunnerContext creates new COdeRunnerContext with giving parameters.
func (*CodeRunnerContext) Test ¶
func (ctx *CodeRunnerContext) Test( directoryWithTests string, testsCount int, ) (TestingResult, error)
Test tests program on given tests and returns result of testing
type ContestInfo ¶
type ContestInfo struct { Problems []ProblemInfo `json:"problems"` Contestants map[string]*ContestantInfo `json:"contestants"` StartTime time.Time `json:"startTime"` }
ContestInfo represents information about contest such as Problems names, Contestants information and StartTime of the contest
var Contest *ContestInfo
func NewContestInfo ¶
func NewContestInfo( problems []ProblemInfo, contestants map[string]*ContestantInfo, startTime time.Time, ) *ContestInfo
NewContestInfo creates pointer of type ContestInfo
type ContestantInfo ¶
type ContestantInfo struct { Id string `json:"id"` Name string `json:"name"` Points int `json:"points"` Penalty int64 `json:"penalty"` Runs []RunInfo `json:"runs"` Results map[ProblemInfo]RunInfo `json:"results"` AdditionalPenalty map[ProblemInfo]int64 `json:"additionalPenalty"` // contains filtered or unexported fields }
ContestantInfo represents information about the contestant such as Name, Points, Penalty and information about his Runs.
func NewContestantInfo ¶
func NewContestantInfo(id, name string) *ContestantInfo
NewContestantInfo creates pointer of type ContestantInfo
type Run ¶
type Run struct {
// contains filtered or unexported fields
}
Run represents information that need to execute program on the specified tests
func (*Run) RunTests ¶
func (ts *Run) RunTests() (TestingResult, error)
RunTests runs tests and return the result of testing
type RunInfo ¶
type RunInfo struct { Id string `json:"id"` Problem ProblemInfo `json:"problem"` Result TestingResult `json:"result"` Time int64 `json:"time"` FileName string `json:"fileName"` Language string `json:"language"` }
RunInfo represents information about the run such as Id, Problem, Result, Time and FileName
func NewRunInfo ¶
func NewRunInfo(id, problem string, result TestingResult, t int64, fileName, language string) *RunInfo
NewRunInfo creates pointer of type RunInfo with given RunInfo.Result and RunInfo.Time
type TestResult ¶
type TestResult int
TestResult type of the enum
func (*TestResult) GetString ¶
func (t *TestResult) GetString() string
GetString returns string representation of the test result
type TestingResult ¶
type TestingResult struct { Number int `json:"number"` Result TestResult `json:"result"` }
TestingResult is a struct that contains information about test result.
func (*TestingResult) String ¶
func (t *TestingResult) String() string
String return string representation of TestingResult.