mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
add: leetcode 0458 test
This commit is contained in:
52
leetcode/0458.Poor-Pigs/458.Poor Pigs_test.go
Normal file
52
leetcode/0458.Poor-Pigs/458.Poor Pigs_test.go
Normal file
@ -0,0 +1,52 @@
|
||||
package leetcode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type question458 struct {
|
||||
para458
|
||||
ans458
|
||||
}
|
||||
|
||||
// para 是参数
|
||||
type para458 struct {
|
||||
buckets int
|
||||
minutesToDie int
|
||||
minutesToTest int
|
||||
}
|
||||
|
||||
// ans 是答案
|
||||
type ans458 struct {
|
||||
ans int
|
||||
}
|
||||
|
||||
func Test_Problem458(t *testing.T) {
|
||||
|
||||
qs := []question458{
|
||||
|
||||
{
|
||||
para458{1000, 15, 60},
|
||||
ans458{5},
|
||||
},
|
||||
|
||||
{
|
||||
para458{4, 15, 15},
|
||||
ans458{2},
|
||||
},
|
||||
|
||||
{
|
||||
para458{4, 15, 30},
|
||||
ans458{2},
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("------------------------Leetcode Problem 458------------------------\n")
|
||||
|
||||
for _, q := range qs {
|
||||
_, p := q.ans458, q.para458
|
||||
fmt.Printf("【input】:%v 【output】:%v\n", p, poorPigs(p.buckets, p.minutesToDie, p.minutesToTest))
|
||||
}
|
||||
fmt.Printf("\n\n\n")
|
||||
}
|
Reference in New Issue
Block a user