Skip to content

Commit

Permalink
fix(test): error output improve
Browse files Browse the repository at this point in the history
  • Loading branch information
MSilva95 committed May 10, 2024
1 parent d0a69d4 commit 61e10bf
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions tests/canjump_test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package main
import (
"log"
"reflect"
"strconv"
"strings"
student "student"
)

Expand Down Expand Up @@ -32,20 +30,12 @@ func main() {
for _, tc := range tests {
got := student.CanJump(tc.args)
if !reflect.DeepEqual(got, tc.want) {
log.Fatalf("%s(%#v) == %#v instead of %#v\n",
log.Fatalf("%s(%+v) == %+v instead of %+v\n",
"CanJump",
uintSliceToString(tc.args),
tc.args,
got,
tc.want,
)
}
}
}

func uintSliceToString(nums []uint) string {
var strSlice []string
for _, num := range nums {
strSlice = append(strSlice, strconv.FormatUint(uint64(num), 10))
}
return "[" + strings.Join(strSlice, ", ") + "]"
}

0 comments on commit 61e10bf

Please sign in to comment.