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

Function Test_getSum

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

Source from the content-addressed store, hash-verified

6)
7
8func Test_getSum(t *testing.T) {
9 type args struct {
10 a int
11 b int
12 }
13 tests := []struct {
14 name string
15 args args
16 want int
17 }{
18 {
19 name: "sum of two integers",
20 args: args{
21 a: 2,
22 b: 3,
23 },
24 want: 5,
25 },
26 {
27 name: "sum of two integers",
28 args: args{
29 a: 1,
30 b: 2,
31 },
32 want: 3,
33 },
34 {
35 name: "sum of two integers",
36 args: args{
37 a: -2,
38 b: 3,
39 },
40 want: 1,
41 },
42 {
43 name: "sum of two integers",
44 args: args{
45 a: -2,
46 b: -3,
47 },
48 want: -5,
49 },
50 }
51 for _, tt := range tests {
52 t.Run(tt.name, func(t *testing.T) {
53 assert.Equal(t, tt.want, getSum(tt.args.a, tt.args.b))
54 })
55 }
56}

Callers

nothing calls this directly

Calls 1

getSumFunction · 0.85

Tested by

no test coverage detected