Documentation ¶
Overview ¶
Package pkg contains internal logic of the application.
Package internal contains internal logic of the application.
Package internal contains internal logic of the application.
Package pkg contains internal logic of the application.
Package internal contains internal logic of the application.
Package internal contains internal logic of the application.
Index ¶
Constants ¶
const ( NONE = TestResult(iota) OK CE RE TL ML WA EOC )
Enum values
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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, compileFile 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 Config ¶
type Config struct {
Workers []WorkerConfig `json:"workers"`
}
type LocalWorker ¶
type LocalWorker struct { }
LocalWorker is a worker that runs tasks locally.
func (*LocalWorker) RunTask ¶
func (lw *LocalWorker) RunTask(task Task) error
RunTask runs task locally.
type RemoteWorker ¶
type RemoteWorker struct {
// contains filtered or unexported fields
}
RemoteWorker is a worker that runs tasks remotely.
func NewRemoteWorker ¶
func NewRemoteWorker(address string) *RemoteWorker
NewRemoteWorker creates new RemoteWorker.
func (*RemoteWorker) RunTask ¶
func (rw *RemoteWorker) RunTask(task Task) error
RunTask runs task remotely.
type Run ¶
type Run struct {
// contains filtered or unexported fields
}
Run represents information that need to execute program on the specified tests
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 RunTask ¶
type RunTask struct {
// contains filtered or unexported fields
}
RunTask is an implementation of Task interface that needed to run tests.
type Task ¶
Task is an interface that can be executed by local Worker or remote Worker.
func CreateRejudgeTask ¶
CreateRejudgeTask creates Task for rejudging tests FIXME: Implement me
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 TestingQueue ¶
type TestingQueue struct {
// contains filtered or unexported fields
}
TestingQueue is a queue for running tasks
func CreateSimpleTestingQueue ¶
func CreateSimpleTestingQueue() *TestingQueue
CreateSimpleTestingQueue creates simple TestingQueue
func NewTestingQueue ¶
func NewTestingQueue(workers chan Worker) *TestingQueue
NewTestingQueue creates new pointer to TestingQueue
func NewTestingQueueFromConfig ¶
func NewTestingQueueFromConfig(config *Config) *TestingQueue
func NewTestingQueueFromFile ¶
func NewTestingQueueFromFile(path string) *TestingQueue
func (*TestingQueue) PushTask ¶
func (tq *TestingQueue) PushTask(task Task)
PushTask pushes task to the queue
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.
type TestingSystem ¶
type TestingSystem struct {
// contains filtered or unexported fields
}
TestingSystem represents the system that runs tests.
func NewTestingSystem ¶
func NewTestingSystem(duration int64, startTime string, testPathForProblem string, testCount int, username string, compileFile string) *TestingSystem
NewTestingSystem creates new TestingSystem with giving parameters.
func (*TestingSystem) RejudgeRun ¶
func (ts *TestingSystem) RejudgeRun(run *RunInfo) error
RejudgeRun rejudges the specified RunInfo