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

Function Test_singleNumber

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

Source from the content-addressed store, hash-verified

6)
7
8func 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}

Callers

nothing calls this directly

Calls 2

singleNumberFunction · 0.85
singleNumber2Function · 0.85

Tested by

no test coverage detected