diff --git a/lang/base.go b/lang/base.go index c0df78f8..d5aff651 100644 --- a/lang/base.go +++ b/lang/base.go @@ -459,9 +459,8 @@ 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 { - tc.Cases = append( - tc.Cases, TestCase{ - No: i/argsNum + 1, + tc.AddCase( + TestCase{ Input: cases[i : i+argsNum], Output: outputs[i/argsNum], }, diff --git a/lang/judge.go b/lang/judge.go index dc113588..08486ad9 100644 --- a/lang/judge.go +++ b/lang/judge.go @@ -10,8 +10,9 @@ import ( "github.com/goccy/go-json" strip "github.com/grokify/html-strip-tags-go" - "github.com/j178/leetgo/leetcode" goutils "github.com/j178/leetgo/testutils/go" + + "github.com/j178/leetgo/leetcode" ) type JudgeResult interface { diff --git a/lang/testcase.go b/lang/testcase.go index ce925af8..e6114219 100644 --- a/lang/testcase.go +++ b/lang/testcase.go @@ -8,8 +8,9 @@ import ( "strconv" "strings" - "github.com/j178/leetgo/leetcode" goutils "github.com/j178/leetgo/testutils/go" + + "github.com/j178/leetgo/leetcode" "github.com/j178/leetgo/utils" ) @@ -170,7 +171,7 @@ func ParseTestCases(q *leetcode.QuestionData, f *FileOutput) (TestCases, error) ) lines := utils.SplitLines(content) for _, line := range lines { - line := strings.TrimSpace(line) + line = strings.TrimSpace(line) switch { case line == "": continue