package models import ( "errors" "git.sch9.ru/new_gate/ms-tester/internal/lib" ) type Result int32 const ( NotTested Result = 0 // change only with schema change Accepted Result = 1 CompilationError Result = 2 MemoryLimitExceeded Result = 3 TimeLimitExceeded Result = 4 SystemFailDuringTesting Result = 5 Testing Result = 6 ) var ErrBadResult = errors.New("bad result") func (result Result) Valid() error { switch result { case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting: return nil } return lib.ServiceError(ErrBadResult, lib.ErrValidationFailed, "bad result") }