(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func Test_majorityElement(t *testing.T) { |
| 9 | type args struct { |
| 10 | nums []int |
| 11 | } |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | args args |
| 15 | want []int |
| 16 | }{ |
| 17 | { |
| 18 | name: "majority element ii", |
| 19 | args: args{ |
| 20 | nums: []int{ |
| 21 | 3, 2, 3, |
| 22 | }, |
| 23 | }, |
| 24 | want: []int{ |
| 25 | 3, |
| 26 | }, |
| 27 | }, |
| 28 | { |
| 29 | name: "majority element ii", |
| 30 | args: args{ |
| 31 | nums: []int{ |
| 32 | 1, 1, 1, 3, 3, 2, 2, 2, |
| 33 | }, |
| 34 | }, |
| 35 | want: []int{ |
| 36 | 1, 2, |
| 37 | }, |
| 38 | }, |
| 39 | } |
| 40 | for _, tt := range tests { |
| 41 | t.Run(tt.name, func(t *testing.T) { |
| 42 | assert.Equal(t, tt.want, majorityElement(tt.args.nums)) |
| 43 | }) |
| 44 | } |
| 45 | } |
nothing calls this directly
no test coverage detected