MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_reverseString

Function Test_reverseString

reverse_string_344/solution_test.go:9–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func Test_reverseString(t *testing.T) {
10 type args struct {
11 s []byte
12 }
13 tests := []struct {
14 name string
15 args args
16 want []byte
17 }{
18 {
19 name: "reverse string",
20 args: args{
21 s: []byte("hello"),
22 },
23 want: []byte("olleh"),
24 },
25 {
26 name: "reverse string",
27 args: args{
28 s: []byte("Hannah"),
29 },
30 want: []byte("hannaH"),
31 },
32 {
33 name: "reverse string",
34 args: args{
35 s: []byte("a"),
36 },
37 want: []byte("a"),
38 },
39 {
40 name: "reverse string",
41 args: args{
42 s: []byte(""),
43 },
44 want: []byte(""),
45 },
46 }
47 for _, tt := range tests {
48 t.Run(tt.name, func(t *testing.T) {
49 reverseString(tt.args.s)
50 if !assert.Equal(t, tt.want, tt.args.s) {
51 fmt.Printf("tt.want: %v \n", tt.want)
52 fmt.Printf("tt.got: %v \n", tt.args.s)
53 }
54 })
55 }
56}

Callers

nothing calls this directly

Calls 1

reverseStringFunction · 0.85

Tested by

no test coverage detected