(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func Test_rotate(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: "rotate image", |
| 19 | args: args{ |
| 20 | matrix: [][]int{ |
| 21 | {1, 2, 3}, |
| 22 | {4, 5, 6}, |
| 23 | {7, 8, 9}, |
| 24 | }, |
| 25 | }, |
| 26 | want: [][]int{ |
| 27 | {7, 4, 1}, |
| 28 | {8, 5, 2}, |
| 29 | {9, 6, 3}, |
| 30 | }, |
| 31 | }, |
| 32 | { |
| 33 | name: "rotate image", |
| 34 | args: args{ |
| 35 | matrix: [][]int{ |
| 36 | {5, 1, 9, 11}, |
| 37 | {2, 4, 8, 10}, |
| 38 | {13, 3, 6, 7}, |
| 39 | {15, 14, 12, 16}, |
| 40 | }, |
| 41 | }, |
| 42 | want: [][]int{ |
| 43 | {15, 13, 2, 5}, |
| 44 | {14, 3, 4, 1}, |
| 45 | {12, 6, 8, 9}, |
| 46 | {16, 7, 10, 11}, |
| 47 | }, |
| 48 | }, |
| 49 | } |
| 50 | for _, tt := range tests { |
| 51 | t.Run(tt.name, func(t *testing.T) { |
| 52 | rotate(tt.args.matrix) |
| 53 | assert.Equal(t, tt.want, tt.args.matrix) |
| 54 | }) |
| 55 | } |
| 56 | } |