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

Function Test_spiralOrder

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

Source from the content-addressed store, hash-verified

6)
7
8func Test_spiralOrder(t *testing.T) {
9 type args struct {
10 matrix [][]int
11 }
12 tests := []struct {
13 name string
14 args args
15 want []int
16 }{
17 {
18 name: "spiral order of matrix",
19 args: args{
20 matrix: [][]int{
21 {1},
22 },
23 },
24 want: []int{
25 1,
26 },
27 },
28 {
29 name: "spiral order of matrix",
30 args: args{
31 matrix: [][]int{
32 {1, 2, 3},
33 {4, 5, 6},
34 {7, 8, 9},
35 },
36 },
37 want: []int{
38 1, 2, 3, 6, 9, 8, 7, 4, 5,
39 },
40 },
41 {
42 name: "spiral order of matrix",
43 args: args{
44 matrix: [][]int{
45 {1, 2, 3, 4},
46 {5, 6, 7, 8},
47 {9, 10, 11, 12},
48 },
49 },
50 want: []int{
51 1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7,
52 },
53 },
54 }
55 for _, tt := range tests {
56 t.Run(tt.name, func(t *testing.T) {
57 assert.Equal(t, tt.want, spiralOrder(tt.args.matrix))
58 })
59 }
60}

Callers

nothing calls this directly

Calls 1

spiralOrderFunction · 0.85

Tested by

no test coverage detected