mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-07 01:44:56 +08:00
add: leetcode 0504 test
This commit is contained in:
46
leetcode/0504.Base-7/504.Base 7_test.go
Normal file
46
leetcode/0504.Base-7/504.Base 7_test.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package leetcode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type question504 struct {
|
||||||
|
para504
|
||||||
|
ans504
|
||||||
|
}
|
||||||
|
|
||||||
|
// para 是参数
|
||||||
|
type para504 struct {
|
||||||
|
num int
|
||||||
|
}
|
||||||
|
|
||||||
|
// ans 是答案
|
||||||
|
type ans504 struct {
|
||||||
|
ans string
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_Problem504(t *testing.T) {
|
||||||
|
|
||||||
|
qs := []question504{
|
||||||
|
|
||||||
|
{
|
||||||
|
para504{100},
|
||||||
|
ans504{"202"},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
para504{-7},
|
||||||
|
ans504{"-10"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("------------------------Leetcode Problem 504------------------------\n")
|
||||||
|
|
||||||
|
for _, q := range qs {
|
||||||
|
_, p := q.ans504, q.para504
|
||||||
|
fmt.Printf("【input】:%v ", p.num)
|
||||||
|
fmt.Printf("【output】:%v \n", convertToBase7(p.num))
|
||||||
|
}
|
||||||
|
fmt.Printf("\n\n\n")
|
||||||
|
}
|
Reference in New Issue
Block a user