Skip to content

Commit 7e9d5af

Browse files
committed
add: leetcode 1518 test
1 parent a3328f0 commit 7e9d5af

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package leetcode
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
)
7+
8+
type question1518 struct {
9+
para1518
10+
ans1518
11+
}
12+
13+
// para 是参数
14+
type para1518 struct {
15+
numBottles int
16+
numExchange int
17+
}
18+
19+
// ans 是答案
20+
type ans1518 struct {
21+
ans int
22+
}
23+
24+
func Test_Problem1518(t *testing.T) {
25+
26+
qs := []question1518{
27+
28+
{
29+
para1518{9, 3},
30+
ans1518{13},
31+
},
32+
33+
{
34+
para1518{15, 4},
35+
ans1518{19},
36+
},
37+
38+
{
39+
para1518{5, 5},
40+
ans1518{6},
41+
},
42+
43+
{
44+
para1518{2, 3},
45+
ans1518{2},
46+
},
47+
}
48+
49+
fmt.Printf("------------------------Leetcode Problem 1518------------------------\n")
50+
51+
for _, q := range qs {
52+
_, p := q.ans1518, q.para1518
53+
fmt.Printf("【input】:%v 【output】:%v\n", p, numWaterBottles(p.numBottles, p.numExchange))
54+
}
55+
fmt.Printf("\n\n\n")
56+
}

0 commit comments

Comments
 (0)