From c9dcb46dc80f03dba49bea9ef02bf1467ec8dc4a Mon Sep 17 00:00:00 2001 From: tphyhFighting <2363176358@qq.com> Date: Mon, 20 Dec 2021 11:04:14 +0800 Subject: [PATCH] add: leetcode 0997 test --- .../997.Find the Town Judge_test.go | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 leetcode/0997.Find-the-Town-Judge/997.Find the Town Judge_test.go diff --git a/leetcode/0997.Find-the-Town-Judge/997.Find the Town Judge_test.go b/leetcode/0997.Find-the-Town-Judge/997.Find the Town Judge_test.go new file mode 100644 index 00000000..61b2434f --- /dev/null +++ b/leetcode/0997.Find-the-Town-Judge/997.Find the Town Judge_test.go @@ -0,0 +1,51 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question997 struct { + para997 + ans997 +} + +// para 是参数 +type para997 struct { + n int + trust [][]int +} + +// ans 是答案 +type ans997 struct { + ans int +} + +func Test_Problem997(t *testing.T) { + + qs := []question997{ + + { + para997{2, [][]int{{1, 2}}}, + ans997{2}, + }, + + { + para997{3, [][]int{{1, 3}, {2, 3}}}, + ans997{3}, + }, + + { + para997{3, [][]int{{1, 3}, {2, 3}, {3, 1}}}, + ans997{-1}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 997------------------------\n") + + for _, q := range qs { + _, p := q.ans997, q.para997 + fmt.Printf("【input】:%v 【output】:%v\n", p, findJudge(p.n, p.trust)) + } + fmt.Printf("\n\n\n") +}