Compare commits
No commits in common. "c218c9306926547beef90181fc099a88224cb34a" and "1ab6fa4583c2040d5b26b9294957b97094155280" have entirely different histories.
c218c93069
...
1ab6fa4583
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/criyle/go-judge/envexec"
|
||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||
)
|
||||
|
||||
|
@ -23,13 +24,13 @@ type Conf struct {
|
|||
PassComment string `default:"🥳Passed!\n"`
|
||||
FailComment string `default:"🧐Failed...\n"`
|
||||
Cases []struct {
|
||||
IgnoreResultStatus bool
|
||||
Outputs []struct {
|
||||
Score int
|
||||
FileName string
|
||||
AnswerPath string
|
||||
CompareSpace bool
|
||||
AlwaysHide bool
|
||||
ForceQuitOnDiff bool
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +54,13 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
|||
result := results[i]
|
||||
score := 0
|
||||
comment := ""
|
||||
if !caseConf.IgnoreResultStatus &&
|
||||
result.Status != stage.Status(envexec.StatusAccepted) {
|
||||
forceQuit = true
|
||||
comment += fmt.Sprintf(
|
||||
"Unexpected executor status: %s.", result.Status,
|
||||
)
|
||||
} else {
|
||||
for _, output := range caseConf.Outputs {
|
||||
answer, err := os.ReadFile(output.AnswerPath)
|
||||
if err != nil {
|
||||
|
@ -68,9 +76,6 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
|||
score += output.Score
|
||||
comment += conf.PassComment
|
||||
} else {
|
||||
if output.ForceQuitOnDiff {
|
||||
forceQuit = true
|
||||
}
|
||||
comment += conf.FailComment
|
||||
comment += fmt.Sprintf("Difference found in `%s`.\n",
|
||||
output.FileName)
|
||||
|
@ -96,6 +101,7 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
res = append(res, stage.ParserResult{
|
||||
Score: score,
|
||||
Comment: comment,
|
||||
|
|
Loading…
Reference in New Issue
Block a user