MCPcopy
hub / github.com/minio/minio-go / TestIsValidIP

Function TestIsValidIP

pkg/s3utils/utils_test.go:132–152  ·  view source on GitHub ↗

Tests validate IP address validator.

(t *testing.T)

Source from the content-addressed store, hash-verified

130
131// Tests validate IP address validator.
132func TestIsValidIP(t *testing.T) {
133 testCases := []struct {
134 // Input.
135 ip string
136 // Expected result.
137 result bool
138 }{
139 {"192.168.1.1", true},
140 {"192.168.1", false},
141 {"192.168.1.1.1", false},
142 {"-192.168.1.1", false},
143 {"260.192.1.1", false},
144 }
145
146 for i, testCase := range testCases {
147 result := IsValidIP(testCase.ip)
148 if testCase.result != result {
149 t.Errorf("Test %d: Expected isValidIP to be '%v' for input \"%s\", but found it to be '%v' instead", i+1, testCase.result, testCase.ip, result)
150 }
151 }
152}
153
154// Tests validate virtual host validator.
155func TestIsVirtualHostSupported(t *testing.T) {

Callers

nothing calls this directly

Calls 1

IsValidIPFunction · 0.85

Tested by

no test coverage detected