From e4a75a074bca942b048b8832e973a0d531dcd893 Mon Sep 17 00:00:00 2001 From: tho <tho@wiback.org> Date: Tue, 6 Jan 2009 17:11:03 +0000 Subject: [PATCH] add test to demonstrate bug --- Packets/VectorParser.test.cc | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Packets/VectorParser.test.cc b/Packets/VectorParser.test.cc index e1f9d2b74..d827bc979 100644 --- a/Packets/VectorParser.test.cc +++ b/Packets/VectorParser.test.cc @@ -220,10 +220,23 @@ namespace { SENF_PARSER_FINALIZE( TestVectorParser ); }; + + struct TestVectorPacketType + : public senf::PacketTypeBase, + public senf::PacketTypeMixin<TestVectorPacketType> + { + typedef senf::PacketTypeMixin<TestVectorPacketType> mixin; + typedef TestVectorParser parser; + + using mixin::nextPacketRange; + using mixin::init; + using mixin::initSize; + }; + typedef senf::ConcretePacket<TestVectorPacketType> TestVectorPacket; } -BOOST_AUTO_UNIT_TEST(vectorMacro) +BOOST_AUTO_UNIT_TEST(vectorMacro_parse) { unsigned char data[] = { 0x05, // size1 0x04, // size2 @@ -247,6 +260,34 @@ BOOST_AUTO_UNIT_TEST(vectorMacro) BOOST_CHECK_EQUAL( parser.vec2()[1], 0x0D0Eu ); } +BOOST_AUTO_UNIT_TEST(vectorMacro_create) +{ + /* + * This test fails with "... is an inaccessible base of ..." error + * see bugtracker @ berlios + TestVectorPacket p (TestVectorPacket::create()); + p->dummy() = 0x01020304u; + p->vec1().push_back( 0x0506u); + p->vec1().push_back( 0x0708u); + p->vec1().push_back( 0x090Au); + p->vec2().push_back( 0x0B0Cu); + p->vec2().push_back( 0x0D0Eu); + p.finalizeAll(); + + unsigned char data[] = { + 0x05, // size1 + 0x04, // size2 + 0x01, 0x02, 0x03, 0x04, // dummy + 0x05, 0x06, // vec1[0] + 0x07, 0x08, // vec1[1] + 0x09, 0x0A, // vec1[2] + 0x0B, 0x0C, // vec2[0] + 0x0D, 0x0E }; // vec2[1] + + BOOST_CHECK( equal( p.data().begin(), p.data().end(), data )); + */ +} + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ -- GitLab