mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-07 01:44:56 +08:00
add: leetcode 0506 test
This commit is contained in:
45
leetcode/0506.Relative-Ranks/506.Relative Ranks_test.go
Normal file
45
leetcode/0506.Relative-Ranks/506.Relative Ranks_test.go
Normal file
@ -0,0 +1,45 @@
|
||||
package leetcode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type question506 struct {
|
||||
para506
|
||||
ans506
|
||||
}
|
||||
|
||||
// para 是参数
|
||||
type para506 struct {
|
||||
score []int
|
||||
}
|
||||
|
||||
// ans 是答案
|
||||
type ans506 struct {
|
||||
ans []string
|
||||
}
|
||||
|
||||
func Test_Problem506(t *testing.T) {
|
||||
|
||||
qs := []question506{
|
||||
|
||||
{
|
||||
para506{[]int{5, 4, 3, 2, 1}},
|
||||
ans506{[]string{"Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"}},
|
||||
},
|
||||
|
||||
{
|
||||
para506{[]int{10, 3, 8, 9, 4}},
|
||||
ans506{[]string{"Gold Medal", "5", "Bronze Medal", "Silver Medal", "4"}},
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("------------------------Leetcode Problem 506------------------------\n")
|
||||
|
||||
for _, q := range qs {
|
||||
_, p := q.ans506, q.para506
|
||||
fmt.Printf("【input】:%v 【output】:%v\n", p.score, findRelativeRanks(p.score))
|
||||
}
|
||||
fmt.Printf("\n\n\n")
|
||||
}
|
Reference in New Issue
Block a user