File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 44 "context"
55 "encoding/base64"
66 "errors"
7+ "math"
78 "net/url"
89 "strconv"
910 "testing"
@@ -102,6 +103,26 @@ func Test_azure_push(t *testing.T) {
102103 _ = localFile .Close ()
103104}
104105
106+ func TestValidateAndConvertToUint16 (t * testing.T ) {
107+ tests := []struct {
108+ desc string
109+ input int
110+ output uint16
111+ }{
112+ {"less than 0" , - 1 , uint16 (0 )},
113+ {"is 0" , 0 , uint16 (0 )},
114+ {"is max uint16" , math .MaxUint16 , uint16 (math .MaxUint16 )},
115+ {"in uint16 range" , 10 , uint16 (10 )},
116+ {"greater than uint16 range" , math .MaxUint16 + 1 , uint16 (0 )},
117+ }
118+
119+ for _ , tc := range tests {
120+ result := validateAndConvertToUint16 (tc .input )
121+
122+ assert .Equal (t , tc .output , result )
123+ }
124+ }
125+
105126func Test_azure_fetch (t * testing.T ) {
106127 testPipelineMock := testPipeline {}
107128
You can’t perform that action at this time.
0 commit comments