net/addr/ip: Add InAnyAddr FromStr conversion
Change-Id: Id8803cc3368408ee8c2208eeb50d64dc467949bc
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/net/addr/ip.cpp b/test/net/addr/ip.cpp
index 7296a1d..74e72b2 100644
--- a/test/net/addr/ip.cpp
+++ b/test/net/addr/ip.cpp
@@ -153,4 +153,14 @@
std::hash<InAnyAddr>{}(In6Addr{});
}
+TEST(FromStr, InAnyAddr)
+{
+ constexpr FromStr<InAnyAddr> fs;
+ EXPECT_EQ((In4Addr{}), fs("0.0.0.0"sv));
+ EXPECT_EQ((In6Addr{}), fs("::"sv));
+ EXPECT_EQ(
+ (In6Addr{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 192, 168, 0, 1}),
+ fs("::ffff:192.168.0.1"sv));
+}
+
} // namespace stdplus