Skip to content

Commit 84f3480

Browse files
committed
Create adding-spaces-to-a-string_test.go
1 parent aea2f01 commit 84f3480

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

adding-spaces-to-a-string_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package leetcode_solutions_golang
2+
3+
import "testing"
4+
5+
func Test_addSpaces(t *testing.T) {
6+
type args struct {
7+
s string
8+
spaces []int
9+
}
10+
tests := []struct {
11+
name string
12+
args args
13+
want string
14+
}{
15+
{
16+
name: "test case 1",
17+
args: args{
18+
s: "hello",
19+
spaces: []int{1, 3},
20+
},
21+
want: "h el lo",
22+
},
23+
}
24+
for _, tt := range tests {
25+
t.Run(tt.name, func(t *testing.T) {
26+
if got := addSpaces(tt.args.s, tt.args.spaces); got != tt.want {
27+
t.Errorf("addSpaces() = %v, want %v", got, tt.want)
28+
}
29+
})
30+
}
31+
}

0 commit comments

Comments
 (0)