Id keyword, again
[senf.git] / Packets / ParseVec.test.cc
index 35079a7..74e028f 100644 (file)
 //#include "ParseVec.test.ih"
 
 // Custom includes
-#include "ParseVec.hh"
-#include "ParseInt.hh"
-#include "PacketType.hh"
+#include "Packets.hh"
 
-#include <boost/test/auto_unit_test.hpp>
+#include "../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 #include <boost/assign.hpp>
 
@@ -50,34 +48,34 @@ BOOST_AUTO_UNIT_TEST(parseVec)
     senf::PacketInterpreterBase::ptr p (senf::PacketInterpreter<VoidPacket>::create(data));
     typedef senf::Parse_Vector<
         senf::Parse_UInt16,
-        senf::detail::Parse_VectorN_Sizer<senf::Parse_UInt8>
+        senf::detail::Parse_VectorN_Sizer<senf::Parse_UInt8, 1u>
         > Parse_UInt16Vec;
 
     {
-        Parse_UInt16Vec v (p->data().begin(), &p->data());
+        Parse_UInt16Vec v (boost::next(p->data().begin(), 1), &p->data());
         
         BOOST_CHECK_EQUAL( v[0], 0x1011 );
         BOOST_CHECK_EQUAL( v[2], 0x1415 );
         BOOST_CHECK_EQUAL( v.size(), 3u );
-        BOOST_CHECK_EQUAL( v.bytes(), 7u );
+        BOOST_CHECK_EQUAL( v.bytes(), 6u );
         BOOST_CHECK( ! v.empty() );
         p->data()[0] = 0x06;
         BOOST_CHECK_EQUAL( v.size(), 6u );
-        BOOST_CHECK_EQUAL( v.bytes(), 13u );
+        BOOST_CHECK_EQUAL( v.bytes(), 12u );
         
         Parse_UInt16Vec::iterator b (v.begin());
         Parse_UInt16Vec::iterator e (v.end());
         BOOST_CHECK_EQUAL(std::distance(b,e), Parse_UInt16Vec::difference_type(v.size()));
     }
 
-    // Warning: Each of the followingoperations invalidate the parser -> we need to recreate it at
+    // Warning: Each of the following operations invalidate the parser -> we need to recreate it at
     // each step
 
     // And since all these members directly call the corresponding members in the container wrapper,
     // we don't need to check them again below ...
 
     {
-#       define v Parse_UInt16Vec(p->data().begin(),&p->data())
+#       define v Parse_UInt16Vec(boost::next(p->data().begin(),1),&p->data())
 
         v.push_back(0xf0f1u,2);
         BOOST_CHECK_EQUAL( v.size(), 8u );
@@ -125,9 +123,9 @@ BOOST_AUTO_UNIT_TEST(parseVec_wrapper)
     senf::PacketInterpreterBase::ptr p (senf::PacketInterpreter<VoidPacket>::create(data));
     typedef senf::Parse_Vector<
         senf::Parse_UInt16,
-        senf::detail::Parse_VectorN_Sizer<senf::Parse_UInt8>
+        senf::detail::Parse_VectorN_Sizer<senf::Parse_UInt8, 1u>
         > Parse_UInt16Vec;
-    Parse_UInt16Vec v (p->data().begin(), &p->data());
+    Parse_UInt16Vec v (boost::next(p->data().begin(),1), &p->data());
     Parse_UInt16Vec::container w (v);
 
     BOOST_CHECK_EQUAL( w[0], 0x1011 );