added FormFeed character for emacs to end of files
[senf.git] / senf / Packets / DefaultBundle / ICMPv6Packet.test.cc
index 9b61d53..0d288d1 100644 (file)
@@ -31,6 +31,7 @@
 #include <senf/Utils/auto_unit_test.hh>
 #include <boost/test/test_tools.hpp>
 
+///////////////////////////////cc.p////////////////////////////////////////
 
 BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet)
 {
@@ -160,6 +161,8 @@ BOOST_AUTO_UNIT_TEST(ICMPv6Packet_packet)
 
 BOOST_AUTO_UNIT_TEST(ICMPv6Packet_create)
 {
+    std::ostringstream oss (std::ostringstream::out);
+    
     unsigned char ping[] = { 0x60, 0x00, 0x00, 0x00, 0x00, 0x40, 0x3a, 0x40,
                              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
@@ -193,30 +196,49 @@ BOOST_AUTO_UNIT_TEST(ICMPv6Packet_create)
 
     ip.finalizeAll();
     
-    std::stringstream ss;
-    ip.dump(ss);
-    BOOST_CHECK_EQUAL( ss.str(), 
-                       "Internet protocol Version 6:\n"
-                       "  version                 : 6\n"
-                       "  traffic class           : 0x00\n"
-                       "  flow label              : 0x00000\n"
-                       "  payload length          : 64\n"
-                       "  next header             : 58\n"
-                       "  hop limit               : 64\n"
-                       "  source                  : ::1\n"
-                       "  destination             : ::1\n"
-                       "ICMPv6 protocol:\n"
-                       "  type                    : 128\n"
-                       "  code                    : 0\n"
-                       "  checksum                : 0xdae0\n"
-                       "ICMPv6 Echo Request:\n"
-                       "  identifier              : 40830\n"
-                       "  sequence nr.            : 9\n"
-                       "Payload data (56 bytes)\n" );
+    SENF_CHECK_NO_THROW (ip.dump( oss ));
+
+    std::string dump (
+        "Internet protocol Version 6:\n"
+        "  version                 : 6\n"
+        "  traffic class           : 0x00\n"
+        "  flow label              : 0x00000\n"
+        "  payload length          : 64\n"
+        "  next header             : 58\n"
+        "  hop limit               : 64\n"
+        "  source                  : ::1\n"
+        "  destination             : ::1\n"
+        "ICMPv6 protocol:\n"
+        "  type                    : 128\n"
+        "  code                    : 0\n"
+        "  checksum                : 0xdae0\n"
+        "ICMPv6 Echo Request:\n"
+        "  Identifier              : 40830\n"
+        "  SequenceNumber          : 9\n"
+        "Payload data (56 bytes)\n"
+        );
+
+    {
+        std::stringstream ss;
+        ip.dump(ss);
+        BOOST_CHECK_EQUAL( ss.str(), dump );
+    }
+
     SENF_CHECK_EQUAL_COLLECTIONS( ip.data().begin(), ip.data().end(),
                                   ping, ping+sizeof(ping) );
+
+    senf::IPv6Packet orig (senf::IPv6Packet::create(ping));
+
+    {
+        std::stringstream ss;
+        orig.dump(ss);
+        BOOST_CHECK_EQUAL( ss.str(), dump );
+    }
 }
 
+///////////////////////////////cc.e////////////////////////////////////////
+
+\f
 // Local Variables:
 // mode: c++
 // fill-column: 100