From aea1f7debb4a0333e83b8c7e203f09a62d754d55 Mon Sep 17 00:00:00 2001 From: Augusto Date: Fri, 3 Apr 2020 14:14:31 +0100 Subject: [PATCH] Fix the issue with the error message not appearing in the same order The function Equal result checks if all the lines appear in the result independently of the order --- go/tests/rc/rc_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/go/tests/rc/rc_test.go b/go/tests/rc/rc_test.go index 9843ce8ad..d7f392aa3 100644 --- a/go/tests/rc/rc_test.go +++ b/go/tests/rc/rc_test.go @@ -116,7 +116,7 @@ Cheating: func Compare(t *testing.T, argsAndSol map[string]string) { for args, sol := range argsAndSol { out, err := z01.MainOut("../rc", strings.Split(args, " ")...) - if out != sol && err != nil && err.Error() != sol { + if EqualResult(out, sol) && err != nil && EqualResult(err.Error(), sol) { fmt.Println(args, "\nError:", err) fmt.Println("Solution:", sol) // fmt.Println("Out:", out) @@ -124,3 +124,12 @@ func Compare(t *testing.T, argsAndSol map[string]string) { } } } + +func EqualResult(out, sol string) bool { + for _, v := range strings.Split(out, "\n") { + if strings.Contains(v, sol) { + return true + } + } + return false +}