Compare commits
2 Commits
1ab6fa4583
...
c218c93069
Author | SHA1 | Date | |
---|---|---|---|
c218c93069 | |||
a001b26b66 |
|
@ -7,7 +7,6 @@ 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"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,13 +23,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,13 +53,6 @@ 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 {
|
||||||
|
@ -76,6 +68,9 @@ 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)
|
||||||
|
@ -101,7 +96,6 @@ 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