Skip to content

Commit f0db80f

Browse files
author
openset
committed
Add: test case
1 parent 75fbbbd commit f0db80f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

problems/3sum-closest/3sum_closest_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ func TestThreeSumClosest(t *testing.T) {
1515
target: 1,
1616
expected: 2,
1717
},
18+
{
19+
input: []int{-1, 0, 1, 2, -1, -4},
20+
target: 1,
21+
expected: 1,
22+
},
23+
{
24+
input: []int{0, 0, 0, 0},
25+
target: 1,
26+
expected: 0,
27+
},
28+
{
29+
input: []int{-2, 0, 0, 2, 2, 2},
30+
target: 2,
31+
expected: 2,
32+
},
33+
{
34+
input: []int{-2, 0, 0, 2, 2, 2, 2},
35+
target: 1,
36+
expected: 0,
37+
},
1838
}
1939
for _, tc := range tests {
2040
output := threeSumClosest(tc.input, tc.target)

0 commit comments

Comments
 (0)