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

Function Test_reverseStr

reverse_string_ii_541/solution_test.go:5–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func Test_reverseStr(t *testing.T) {
6 type args struct {
7 s string
8 k int
9 }
10 tests := []struct {
11 name string
12 args args
13 want string
14 }{
15 {
16 name: "",
17 args: args{
18 s: "abcdefg",
19 k: 2,
20 },
21 want: "bacdfeg",
22 },
23 {
24 name: "",
25 args: args{
26 s: "abcdefgi",
27 k: 2,
28 },
29 want: "bacdfegi",
30 },
31 {
32 name: "",
33 args: args{
34 s: "abcd",
35 k: 2,
36 },
37 want: "bacd",
38 },
39 {
40 name: "",
41 args: args{
42 s: "abcd",
43 k: 4,
44 },
45 want: "dcba",
46 },
47 {
48 name: "",
49 args: args{
50 s: "abcdefg",
51 k: 3,
52 },
53 want: "cbadefg",
54 },
55 }
56 for _, tt := range tests {
57 t.Run(tt.name, func(t *testing.T) {
58 if got := reverseStr(tt.args.s, tt.args.k); got != tt.want {
59 t.Errorf("reverseStr() = %v, want %v", got, tt.want)
60 }
61 })
62 }

Callers

nothing calls this directly

Calls 1

reverseStrFunction · 0.85

Tested by

no test coverage detected