Browse Source

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
pull/646/head
Augusto 5 years ago committed by xpetit
parent
commit
aea1f7debb
  1. 11
      go/tests/rc/rc_test.go

11
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
}

Loading…
Cancel
Save