test: Simplify addresses with string literal operators

This improves code readability.

Change-Id: I9c15f8df7ab40bc864a34f53d61f25bb1bbf349f
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp
index 74768c1..27d9b1e 100644
--- a/test/test_ethernet_interface.cpp
+++ b/test/test_ethernet_interface.cpp
@@ -23,6 +23,7 @@
 using std::literals::string_view_literals::operator""sv;
 using testing::Key;
 using testing::UnorderedElementsAre;
+using stdplus::operator""_sub;
 
 class TestEthernetInterface : public stdplus::gtest::TestWithTmp
 {
@@ -110,30 +111,26 @@
                  InvalidArgument);
 
     createIPObject(IP::Protocol::IPv4, "10.10.10.10", 16);
-    EXPECT_THAT(interface.addrs, UnorderedElementsAre(Key(stdplus::SubnetAny(
-                                     stdplus::In4Addr{10, 10, 10, 10}, 16))));
+    EXPECT_THAT(interface.addrs,
+                UnorderedElementsAre(Key("10.10.10.10/16"_sub)));
 }
 
 TEST_F(TestEthernetInterface, AddMultipleAddress)
 {
     createIPObject(IP::Protocol::IPv4, "10.10.10.10", 16);
     createIPObject(IP::Protocol::IPv4, "20.20.20.20", 16);
-    EXPECT_THAT(
-        interface.addrs,
-        UnorderedElementsAre(
-            Key(stdplus::SubnetAny(stdplus::In4Addr{10, 10, 10, 10}, 16)),
-            Key(stdplus::SubnetAny(stdplus::In4Addr{20, 20, 20, 20}, 16))));
+    EXPECT_THAT(interface.addrs,
+                UnorderedElementsAre(Key("10.10.10.10/16"_sub),
+                                     Key("20.20.20.20/16"_sub)));
 }
 
 TEST_F(TestEthernetInterface, DeleteIPAddress)
 {
     createIPObject(IP::Protocol::IPv4, "10.10.10.10", 16);
     createIPObject(IP::Protocol::IPv4, "20.20.20.20", 16);
-    interface.addrs
-        .at(stdplus::SubnetAny(stdplus::In4Addr{10, 10, 10, 10}, 16))
-        ->delete_();
-    EXPECT_THAT(interface.addrs, UnorderedElementsAre(Key(stdplus::SubnetAny(
-                                     stdplus::In4Addr{20, 20, 20, 20}, 16))));
+    interface.addrs.at("10.10.10.10/16"_sub)->delete_();
+    EXPECT_THAT(interface.addrs,
+                UnorderedElementsAre(Key("20.20.20.20/16"_sub)));
 }
 
 TEST_F(TestEthernetInterface, CheckObjectPath)
diff --git a/test/test_rtnetlink.cpp b/test/test_rtnetlink.cpp
index 32a98aa..795dcdc 100644
--- a/test/test_rtnetlink.cpp
+++ b/test/test_rtnetlink.cpp
@@ -10,6 +10,9 @@
 namespace phosphor::network::netlink
 {
 
+using stdplus::operator""_sub;
+using stdplus::operator""_ip;
+
 TEST(IntfFromRtm, SmallMsg)
 {
     EXPECT_THROW(intfFromRtm("1"), std::runtime_error);
@@ -91,8 +94,7 @@
     EXPECT_EQ(msg.ifa.ifa_flags, ret.flags);
     EXPECT_EQ(msg.ifa.ifa_scope, ret.scope);
     EXPECT_EQ(msg.ifa.ifa_index, ret.ifidx);
-    EXPECT_EQ((stdplus::SubnetAny{stdplus::In4Addr{192, 168, 1, 20}, 28}),
-              ret.ifaddr);
+    EXPECT_EQ("192.168.1.20/28"_sub, ret.ifaddr);
 }
 
 TEST(AddrFromRtm, ExtraFlags)
@@ -140,7 +142,7 @@
 
     auto ret = neighFromRtm(stdplus::raw::asView<char>(msg));
     EXPECT_EQ(msg.ndm.ndm_state, ret.state);
-    EXPECT_EQ((stdplus::In4Addr{192, 168, 1, 20}), ret.addr);
+    EXPECT_EQ("192.168.1.20"_ip, ret.addr);
     EXPECT_FALSE(ret.mac);
 }
 
@@ -161,7 +163,7 @@
     msg.mac_hdr.rta_len = RTA_LENGTH(sizeof(msg.mac));
 
     auto ret = neighFromRtm(stdplus::raw::asView<char>(msg));
-    EXPECT_EQ((stdplus::In4Addr{192, 168, 1, 20}), ret.addr);
+    EXPECT_EQ("192.168.1.20"_ip, ret.addr);
     EXPECT_EQ((ether_addr{1, 2, 3, 4, 5, 6}), ret.mac);
 }