31 lines
711 B
Go
31 lines
711 B
Go
package models
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
type Result int32
|
|
|
|
const (
|
|
NotTested Result = 1 // change only with schema change
|
|
Accepted Result = 2
|
|
WrongAnswer Result = 3
|
|
PresentationError Result = 4
|
|
CompilationError Result = 5
|
|
MemoryLimitExceeded Result = 6
|
|
TimeLimitExceeded Result = 7
|
|
RuntimeError Result = 8
|
|
SystemFailDuringTesting Result = 9
|
|
Testing Result = 10
|
|
)
|
|
|
|
var ErrBadResult = errors.New("bad result")
|
|
|
|
func (result Result) Valid() error {
|
|
switch result {
|
|
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
|
|
return nil
|
|
}
|
|
return ErrBadResult
|
|
}
|