Lines Matching refs:forString
152 TEST(IPAddressTest, forString) { in TEST() argument
155 EXPECT_FALSE(IPAddress::forString("not_an_ip", &ip)); in TEST()
156 EXPECT_FALSE(IPAddress::forString("not_an_ip", nullptr)); in TEST()
157 EXPECT_EQ(IPAddress(), IPAddress::forString("not_an_ip")); in TEST()
159 EXPECT_EQ(IPAddress(IPV4_ANY), IPAddress::forString("0.0.0.0")); in TEST()
160 EXPECT_EQ(IPAddress(IPV4_ONES), IPAddress::forString("255.255.255.255")); in TEST()
161 EXPECT_EQ(IPAddress(IPV4_LOOPBACK), IPAddress::forString("127.0.0.1")); in TEST()
163 EXPECT_EQ(IPAddress(IPV6_ANY), IPAddress::forString("::")); in TEST()
164 EXPECT_EQ(IPAddress(IPV6_ANY), IPAddress::forString("::0")); in TEST()
165 EXPECT_EQ(IPAddress(IPV6_ANY), IPAddress::forString("0::")); in TEST()
166 EXPECT_EQ(IPAddress(IPV6_LOOPBACK), IPAddress::forString("::1")); in TEST()
167 EXPECT_EQ(IPAddress(IPV6_LOOPBACK), IPAddress::forString("0::1")); in TEST()
168 EXPECT_EQ(IPAddress(FE80_1), IPAddress::forString("fe80::1")); in TEST()
169 EXPECT_EQ(IPAddress(FE80_1, 22), IPAddress::forString("fe80::1%22")); in TEST()
171 EXPECT_EQ(IPAddress(FE80_1, 1), IPAddress::forString("fe80::1%lo")); in TEST()
174 TEST(IPPrefixTest, forString) { in TEST() argument
177 EXPECT_FALSE(IPPrefix::forString("", &prefix)); in TEST()
178 EXPECT_FALSE(IPPrefix::forString("invalid", &prefix)); in TEST()
179 EXPECT_FALSE(IPPrefix::forString("192.0.2.0", &prefix)); in TEST()
180 EXPECT_FALSE(IPPrefix::forString("2001::db8::", &prefix)); in TEST()
182 EXPECT_FALSE(IPPrefix::forString("2001:db8::/", &prefix)); in TEST()
183 EXPECT_FALSE(IPPrefix::forString("2001:db8:://32", &prefix)); in TEST()
184 EXPECT_FALSE(IPPrefix::forString("2001:db8::/32z", &prefix)); in TEST()
185 EXPECT_FALSE(IPPrefix::forString("2001:db8::/32/", &prefix)); in TEST()
186 EXPECT_FALSE(IPPrefix::forString("2001:db8::/0x20", &prefix)); in TEST()
187 EXPECT_FALSE(IPPrefix::forString("2001:db8:: /32", &prefix)); in TEST()
188 EXPECT_FALSE(IPPrefix::forString("2001:db8::/ 32", &prefix)); in TEST()
189 EXPECT_FALSE(IPPrefix::forString(" 2001:db8::/32", &prefix)); in TEST()
190 EXPECT_FALSE(IPPrefix::forString("2001:db8::/32 ", &prefix)); in TEST()
191 EXPECT_FALSE(IPPrefix::forString("2001:db8::/+32", &prefix)); in TEST()
193 EXPECT_FALSE(IPPrefix::forString("192.0.2.0/33", &prefix)); in TEST()
194 EXPECT_FALSE(IPPrefix::forString("2001:db8::/129", &prefix)); in TEST()
195 EXPECT_FALSE(IPPrefix::forString("192.0.2.0/-1", &prefix)); in TEST()
196 EXPECT_FALSE(IPPrefix::forString("2001:db8::/-1", &prefix)); in TEST()
198 EXPECT_TRUE(IPPrefix::forString("2001:db8::/32", &prefix)); in TEST()
200 EXPECT_EQ(IPPrefix(IPAddress::forString("2001:db8::"), 32), prefix); in TEST()
202 EXPECT_EQ(IPPrefix(), IPPrefix::forString("invalid")); in TEST()
204 EXPECT_EQ("0.0.0.0/0", IPPrefix::forString("0.0.0.0/0").toString()); in TEST()
205 EXPECT_EQ("::/0", IPPrefix::forString("::/0").toString()); in TEST()
206 EXPECT_EQ("192.0.2.128/25", IPPrefix::forString("192.0.2.131/25").toString()); in TEST()
208 IPPrefix::forString("2001:db8:1:2:3:4:5:6/126").toString()); in TEST()
425 EXPECT_TRUE(IPAddress::forString(expectation.ip, &ip)) in TEST()
429 EXPECT_TRUE(IPAddress::forString(expectation.ipTruncated, &ipTruncated)) in TEST()
463 {LT, IPPrefix(IPAddress(IPV4_ANY), 0), IPPrefix(IPAddress::forString("0.0.0.1"))}, in TEST()
464 {LT, IPPrefix(IPAddress(IPV4_ANY), 1), IPPrefix(IPAddress::forString("0.0.0.1"))}, in TEST()
465 {LT, IPPrefix(IPAddress(IPV4_ANY), 24), IPPrefix(IPAddress::forString("0.0.0.1"))}, in TEST()