Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 97de787

Browse files
Create 3sum-closest_test.go
1 parent 3fd1f1a commit 97de787

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

‎3sum-closest_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_threeSumClosest(t *testing.T) {
6+
type args struct {
7+
nums []int
8+
target int
9+
}
10+
tests := []struct {
11+
name string
12+
args args
13+
want int
14+
}{
15+
{
16+
name: "test1",
17+
args: args{
18+
nums: []int{-1, 2, 1, -4},
19+
target: 1,
20+
},
21+
want: 2,
22+
},
23+
}
24+
for _, tt := range tests {
25+
t.Run(tt.name, func(t *testing.T) {
26+
if got := threeSumClosest(tt.args.nums, tt.args.target); got != tt.want {
27+
t.Errorf("threeSumClosest() = %v, want %v", got, tt.want)
28+
}
29+
})
30+
}
31+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /