models/result.go

31 lines
711 B
Go
Raw Permalink Normal View History

2024-09-23 18:38:34 +00:00
package models
import (
"errors"
)
type Result int32
const (
NotTested Result = 1 // change only with schema change
Accepted Result = 2
2024-10-05 15:19:02 +00:00
WrongAnswer Result = 3
PresentationError Result = 4
2024-09-23 18:38:34 +00:00
CompilationError Result = 5
MemoryLimitExceeded Result = 6
TimeLimitExceeded Result = 7
2024-10-05 15:19:02 +00:00
RuntimeError Result = 8
2024-09-23 18:38:34 +00:00
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
}
2024-10-05 15:19:02 +00:00
return ErrBadResult
2024-09-23 18:38:34 +00:00
}