github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/float_test.go (about) 1 package functions 2 3 import "testing" 4 5 func Test_Float(t *testing.T) { 6 tests := []struct { 7 name string 8 args []interface{} 9 expected float64 10 }{ 11 { 12 name: "Float with 1", 13 args: []interface{}{1}, 14 expected: 1.0, 15 }, 16 { 17 name: "Float with 2", 18 args: []interface{}{"2"}, 19 expected: 2.0, 20 }, 21 { 22 name: "Float with 3", 23 args: []interface{}{"2.3"}, 24 expected: 2.3, 25 }, 26 } 27 28 for _, tt := range tests { 29 t.Run(tt.name, func(t *testing.T) { 30 got := Float(tt.args...) 31 if got != tt.expected { 32 t.Errorf("Float() = %v, want %v", got, tt.expected) 33 } 34 }) 35 } 36 }