go-judge/client/judge_result.go
criyle 1f86f25995 Refactor & Documentation
- pkg/runner -> pkg/envexec
- add idea about executor server
2020-03-03 02:32:59 -05:00

75 lines
1.3 KiB
Go

package client
import (
"time"
"github.com/criyle/go-judge/pkg/envexec"
"github.com/criyle/go-sandbox/runner"
)
// ProgressStatus defines progress status
type ProgressStatus int
// Whether progress success / fail
const (
ProgressSucceeded ProgressStatus = iota + 1
ProgressFailed
)
// ProgressCompiled compiled progress
type ProgressCompiled struct {
Status ProgressStatus
Message string // compiler output if failed
}
// ProgressProgressed contains progress of current task
type ProgressProgressed struct {
// defines which test case finished
SubTaskIndex int
TestCaseIndex int
// test case result
TestCaseResult
}
// JudgeResult contains final result of current task
type JudgeResult struct {
SubTasks []SubTaskResult
Error string
}
// SubTaskResult contains result for single sub-task
type SubTaskResult struct {
Score float64
Cases []TestCaseResult
}
// TestCaseResult contains result for single case
type TestCaseResult struct {
// status
Status ProgressStatus
ExecStatus envexec.Status
// message
Message string
Error string
// score
ScoreRate float64
// detail stats
Time time.Duration
Memory runner.Size
// detail outputs
Input []byte
Answer []byte
// user stdout / stderr
UserOutput []byte
UserError []byte
// spj output
SPJOutput []byte
}