MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_numIslands

Function Test_numIslands

number_of_islands_200/solution_test.go:8–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func Test_numIslands(t *testing.T) {
9 type args struct {
10 grid [][]byte
11 }
12 tests := []struct {
13 name string
14 args args
15 want int
16 }{
17 {
18 name: "number of islands",
19 args: args{
20 grid: [][]byte{
21 {1, 1, 1, 1, 0},
22 {1, 1, 0, 1, 0},
23 {1, 1, 0, 0, 0},
24 {0, 0, 0, 0, 0},
25 },
26 },
27 want: 1,
28 },
29 {
30 name: "number of islands",
31 args: args{
32 grid: [][]byte{
33 {1, 1, 0, 0, 0},
34 {1, 1, 0, 0, 0},
35 {0, 0, 1, 0, 0},
36 {0, 0, 0, 1, 1},
37 },
38 },
39 want: 3,
40 },
41 }
42 for _, tt := range tests {
43 t.Run(tt.name, func(t *testing.T) {
44 assert.Equal(t, tt.want, numIslands(tt.args.grid))
45 })
46 }
47}

Callers

nothing calls this directly

Calls 1

numIslandsFunction · 0.85

Tested by

no test coverage detected