(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func Test_singleNumber(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: "single number in list", |
| 19 | args: args{ |
| 20 | nums: []int{ |
| 21 | 2, 2, 1, |
| 22 | }, |
| 23 | }, |
| 24 | want: 1, |
| 25 | }, |
| 26 | { |
| 27 | name: "single number in list", |
| 28 | args: args{ |
| 29 | nums: []int{ |
| 30 | 2, 1, 2, |
| 31 | }, |
| 32 | }, |
| 33 | want: 1, |
| 34 | }, |
| 35 | { |
| 36 | name: "single number in list", |
| 37 | args: args{ |
| 38 | nums: []int{ |
| 39 | 4, 1, 2, 1, 2, |
| 40 | }, |
| 41 | }, |
| 42 | want: 4, |
| 43 | }, |
| 44 | } |
| 45 | for _, tt := range tests { |
| 46 | t.Run(tt.name, func(t *testing.T) { |
| 47 | assert.Equal(t, tt.want, singleNumber(tt.args.nums)) |
| 48 | assert.Equal(t, tt.want, singleNumber2(tt.args.nums)) |
| 49 | }) |
| 50 | } |
| 51 | } |
nothing calls this directly
no test coverage detected