Skip to content

Commit 8417310

Browse files
committed
Create array-of-doubled-pairs_test.go
1 parent 6f40df8 commit 8417310

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

array-of-doubled-pairs_test.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package leetcode_solutions_golang
2+
3+
import "testing"
4+
5+
func Test_canReorderDoubled(t *testing.T) {
6+
type args struct {
7+
arr []int
8+
}
9+
tests := []struct {
10+
name string
11+
args args
12+
want bool
13+
}{
14+
{
15+
name: "test case 1",
16+
args: args{
17+
arr: []int{3, 1, 3, 6},
18+
},
19+
want: false,
20+
},
21+
{
22+
name: "test case 2",
23+
args: args{
24+
arr: []int{2, 1, 2, 6},
25+
},
26+
want: false,
27+
},
28+
{
29+
name: "test case 3",
30+
args: args{
31+
arr: []int{4, -2, 2, -4},
32+
},
33+
want: true,
34+
},
35+
}
36+
for _, tt := range tests {
37+
t.Run(tt.name, func(t *testing.T) {
38+
if got := canReorderDoubled(tt.args.arr); got != tt.want {
39+
t.Errorf("canReorderDoubled() = %v, want %v", got, tt.want)
40+
}
41+
})
42+
}
43+
}

0 commit comments

Comments
 (0)