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