all unit tests: replaced BOOST_AUTO_UNIT_TEST with new SENF_AUTO_UNIT_TEST macro
[senf.git] / senf / Packets / 80221Bundle / TLVParser.test.cc
index 12d6392..9c6d2c9 100644 (file)
@@ -41,7 +41,8 @@ using namespace senf;
 namespace {
     struct VoidPacket : public PacketTypeBase
     {};
-                           
+}
+
 #define CHECK_TLVParser(tlvParser, ptype, plength)                          \
 {                                                                           \
     BOOST_CHECK_EQUAL( tlvParser.type(),         ptype   );                 \
@@ -53,10 +54,9 @@ namespace {
         dataIterator++;                                                     \
     }                                                                       \
 }
-}
 
 
-BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_simple_length)
+SENF_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_simple_length)
 {
     PacketInterpreterBase::byte data[] = {
         0x01, // type
@@ -69,7 +69,7 @@ BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_simple_length)
 }
 
 
-BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_extended_length)
+SENF_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_extended_length)
 {
     PacketInterpreterBase::byte data[] = {
         0x01, // type
@@ -96,7 +96,7 @@ BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_parse_with_extended_length)
 }
 
 
-BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_simple_length)
+SENF_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_simple_length)
 {
     PacketInterpreterBase::byte value[] = {
            0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09
@@ -106,7 +106,7 @@ BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_simple_length)
     MIHGenericTLVParser tlvParser( p->data().begin(), &p->data());
     tlvParser.type() = 42u;
     tlvParser.value( value);
-    tlvParser.finalizeLength();
+    tlvParser.finalize();
 
     CHECK_TLVParser( tlvParser, 42u, 0x0Au );
 
@@ -120,7 +120,7 @@ BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_simple_length)
 }
 
 
-BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_extended_length)
+SENF_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_extended_length)
 {
     PacketInterpreterBase::byte value[255];
     for (unsigned i=0; i<sizeof(value); i++)
@@ -128,10 +128,10 @@ BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_extended_length)
     PacketInterpreterBase::ptr p (PacketInterpreter<VoidPacket>::create(
             senf::PacketInterpreterBase::size_type(2u)));
     MIHGenericTLVParser tlvParser( p->data().begin(), &p->data());
-    tlvParser.maxLengthValue( MIHTLVLengthParser::max_value);
+    tlvParser.maxLength( MIHTLVLengthParser::max_value);
     tlvParser.type() = 42u;
     tlvParser.value( value);
-    tlvParser.finalizeLength();
+    tlvParser.finalize();
 
     CHECK_TLVParser( tlvParser, 42u, sizeof(value) );
 
@@ -146,22 +146,22 @@ BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_with_extended_length)
 }
 
 
-BOOST_AUTO_UNIT_TEST(MIHGenericTLVParser_create_invalid)
+SENF_AUTO_UNIT_TEST(MIHGenericTLVParser_create_invalid)
 {
     PacketInterpreterBase::ptr p (PacketInterpreter<VoidPacket>::create(
             senf::PacketInterpreterBase::size_type(2u)));
     MIHGenericTLVParser tlvParser( p->data().begin(), &p->data());
     tlvParser.type() = 42u;
-    tlvParser.finalizeLength();
+    tlvParser.finalize();
 
     PacketInterpreterBase::byte value[255];
     for (unsigned i=0; i<sizeof(value); i++)
         value[i] = i;
 
     BOOST_CHECK_THROW( tlvParser.value( value), MIHTLVLengthException);
-    tlvParser.maxLengthValue( sizeof(value));
+    tlvParser.maxLength( sizeof(value));
     tlvParser.value( value);
-    tlvParser.finalizeLength();
+    tlvParser.finalize();
     CHECK_TLVParser( tlvParser, 42u, sizeof(value) );
 }
 
@@ -188,13 +188,13 @@ namespace {
         using mixin::initSize;
 
         static void finalize(ConcretePacket<TestMacAddressTLVPacketType> p) {
-            p->finalizeLength();
+            p->finalize();
         }
     };
     typedef ConcretePacket<TestMacAddressTLVPacketType> TestMacAddressTLVPacket;
 }
 
-BOOST_AUTO_UNIT_TEST(TestMacAddressTLVPacket_create)
+SENF_AUTO_UNIT_TEST(TestMacAddressTLVPacket_create)
 {
     TestMacAddressTLVPacket tlvPacket (TestMacAddressTLVPacket::create());
     tlvPacket->type() = 42;
@@ -207,7 +207,8 @@ BOOST_AUTO_UNIT_TEST(TestMacAddressTLVPacket_create)
         0x0c, // length
         0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67  // value
     };
-    BOOST_CHECK( equal( tlvPacket.data().begin(), tlvPacket.data().end(), data ));
+    SENF_CHECK_EQUAL_COLLECTIONS( 
+            data, data+sizeof(data), tlvPacket.data().begin(), tlvPacket.data().end() );
 }