Socket/Protocols/INet: added operator>> for INet6Network
[senf.git] / senf / Socket / Protocols / INet / INet6Address.test.cc
index 1283cba..e342b27 100644 (file)
@@ -186,7 +186,7 @@ SENF_AUTO_UNIT_TEST(inet6Network)
     BOOST_CHECK( ! net.match(net2) );
     BOOST_CHECK( net2.match(INet6Network("2001:db8:1234::/48")) );
     BOOST_CHECK( ! net2.match(INet6Network("2001:db8:1234::/32")) );
-    
+
     BOOST_CHECK( ! INet6Network("ff14:1234::1/128").match(INet6Network("ff14:1234::2/128")) );
 
     BOOST_CHECK_EQUAL( senf::str(net2), "2001:db8:1230::/44" );
@@ -196,12 +196,28 @@ SENF_AUTO_UNIT_TEST(inet6Network)
 
     BOOST_CHECK_THROW( INet6Network(""), AddressSyntaxException );
     BOOST_CHECK_THROW( INet6Network("2001:db8:1234::/beef"), AddressSyntaxException );
+
+    {
+        std::stringstream str;
+        INet6Network net;
+        str >> net;
+        BOOST_CHECK( str.fail());
+    }
+    {
+        std::stringstream str;
+        INet6Network net ("2001:db8:1230::/44");
+        str << net;
+        BOOST_CHECK_EQUAL( str.str(), "2001:db8:1230::/44");
+        str >> net;
+        BOOST_CHECK( ! str.fail());
+        BOOST_CHECK_EQUAL(net, INet6Network("2001:db8:1230::/44"));
+    }
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 
-\f
+
 // Local Variables:
 // mode: c++
 // fill-column: 100