Skip to content

Commit

Permalink
fix: ignore invalid testcase output
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Nov 9, 2024
1 parent f9a820b commit b59bc62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lang/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,17 @@ func (l baseLang) generateTestCasesContent(q *leetcode.QuestionData) string {
// Assume all questions output are single.
var tc TestCases
for i := 0; i < len(cases) && i/argsNum < len(outputs); i += argsNum {
input := cases[i : i+argsNum]
output := outputs[i/argsNum]

if err := checkOutput(q, input, output); err != nil {
log.Debug("ignore invalid testcase output", "output", output)
output = ""
}
tc.AddCase(
TestCase{
Input: cases[i : i+argsNum],
Output: outputs[i/argsNum],
Input: input,
Output: output,
},
)
}
Expand Down

0 comments on commit b59bc62

Please sign in to comment.