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