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

Function Test_plusOne

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

Source from the content-addressed store, hash-verified

6)
7
8func Test_plusOne(t *testing.T) {
9 type args struct {
10 digits []int
11 }
12 tests := []struct {
13 name string
14 args args
15 want []int
16 }{
17 {
18 name: "plus one",
19 args: args{
20 digits: []int{1, 2, 3},
21 },
22 want: []int{1, 2, 4},
23 },
24 {
25 name: "plus one",
26 args: args{
27 digits: []int{4, 3, 2, 1},
28 },
29 want: []int{4, 3, 2, 2},
30 },
31 {
32 name: "plus one",
33 args: args{
34 digits: []int{0},
35 },
36 want: []int{1},
37 },
38 {
39 name: "plus one",
40 args: args{
41 digits: []int{9, 9, 9},
42 },
43 want: []int{1, 0, 0, 0},
44 },
45 {
46 name: "plus one",
47 args: args{
48 digits: []int{9},
49 },
50 want: []int{1, 0},
51 },
52 }
53 for _, tt := range tests {
54 t.Run(tt.name, func(t *testing.T) {
55 if got := plusOne(tt.args.digits); !reflect.DeepEqual(got, tt.want) {
56 t.Errorf("plusOne() = %v, want %v", got, tt.want)
57 }
58 })
59 }
60}

Callers

nothing calls this directly

Calls 1

plusOneFunction · 0.85

Tested by

no test coverage detected