github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/add_test.go (about) 1 package functions 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func Test_Add(t *testing.T) { 10 tests := []struct { 11 name string 12 args []interface{} 13 expected int 14 }{ 15 { 16 name: "Add with 1 and 2", 17 args: []interface{}{1, 2}, 18 expected: 3, 19 }, 20 { 21 name: "Add with 2 and 3", 22 args: []interface{}{2, 3}, 23 expected: 5, 24 }, 25 { 26 name: "Add with 3 and -4", 27 args: []interface{}{3, -4}, 28 expected: -1, 29 }, 30 } 31 32 for _, tt := range tests { 33 t.Run(tt.name, func(t *testing.T) { 34 got := Add(tt.args...) 35 assert.Equal(t, tt.expected, got) 36 }) 37 } 38 }