Files
LeetCode-Go/leetcode/0200.Number-of-Islands/200. Number of Islands_test.go
2020-08-27 00:58:22 +08:00

58 lines
920 B
Go

package leetcode
import (
"fmt"
"testing"
)
type question200 struct {
para200
ans200
}
// para 是参数
// one 代表第一个参数
type para200 struct {
one [][]byte
}
// ans 是答案
// one 代表第一个答案
type ans200 struct {
one int
}
func Test_Problem200(t *testing.T) {
qs := []question200{
{
para200{[][]byte{
{'1', '1', '1', '1', '0'},
{'1', '1', '0', '1', '0'},
{'1', '1', '0', '0', '0'},
{'0', '0', '0', '0', '0'},
}},
ans200{1},
},
{
para200{[][]byte{
{'1', '1', '0', '0', '0'},
{'1', '1', '0', '0', '0'},
{'0', '0', '1', '0', '0'},
{'0', '0', '0', '1', '1'},
}},
ans200{3},
},
}
fmt.Printf("------------------------Leetcode Problem 200------------------------\n")
for _, q := range qs {
_, p := q.ans200, q.para200
fmt.Printf("【input】:%v 【output】:%v\n", p, numIslands(p.one))
}
fmt.Printf("\n\n\n")
}