add: leetcode 1518 test

This commit is contained in:
tphyhFighting
2021-12-17 10:45:31 +08:00
parent a3328f0d7f
commit 7e9d5af03c

View File

@ -0,0 +1,56 @@
package leetcode
import (
"fmt"
"testing"
)
type question1518 struct {
para1518
ans1518
}
// para 是参数
type para1518 struct {
numBottles int
numExchange int
}
// ans 是答案
type ans1518 struct {
ans int
}
func Test_Problem1518(t *testing.T) {
qs := []question1518{
{
para1518{9, 3},
ans1518{13},
},
{
para1518{15, 4},
ans1518{19},
},
{
para1518{5, 5},
ans1518{6},
},
{
para1518{2, 3},
ans1518{2},
},
}
fmt.Printf("------------------------Leetcode Problem 1518------------------------\n")
for _, q := range qs {
_, p := q.ans1518, q.para1518
fmt.Printf("【input】:%v 【output】:%v\n", p, numWaterBottles(p.numBottles, p.numExchange))
}
fmt.Printf("\n\n\n")
}