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