X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FPacket.test.cc;h=8fe977146782417937dd220dcaebcf4e33c56b3c;hb=9bc655e14d2d8c204ed835896cb51e42d49bd68f;hp=2dafae1bd6e8c54cddd48abfc3ad7e212dbeae9c;hpb=20c3dbf64b3beed10655dceaee5791680fb25383;p=senf.git diff --git a/senf/Packets/Packet.test.cc b/senf/Packets/Packet.test.cc index 2dafae1..8fe9771 100644 --- a/senf/Packets/Packet.test.cc +++ b/senf/Packets/Packet.test.cc @@ -127,9 +127,12 @@ namespace { struct ComplexAnnotation : senf::ComplexAnnotation { - ComplexAnnotation() : s(), i() {} + ComplexAnnotation() : s("empty"), i(-1) {} std::string s; boost::int32_t i; + // padding so the size does not depend on the platform ... + struct _ {std::string s;boost::int32_t i;}; + char __ [32-sizeof(_)]; }; std::ostream & operator<<(std::ostream & os, ComplexAnnotation const & v) @@ -321,6 +324,10 @@ SENF_AUTO_UNIT_TEST(packetAnnotation) BarPacket::createAfter(packet); ComplexAnnotation & ca (packet.annotation()); + + BOOST_CHECK_EQUAL( ca.s, "empty" ); + BOOST_CHECK_EQUAL( ca.i, -1 ); + ca.s = "dead beef"; ca.i = 0x12345678; SENF_CHECK_NO_THROW( packet.annotation().value = 0xDEADBEEF ); @@ -336,20 +343,17 @@ SENF_AUTO_UNIT_TEST(packetAnnotation) BOOST_CHECK( Reg::lookup() < 0 ); BOOST_CHECK( Reg::lookup() < 0 ); -#ifdef SENF_DEBUG std::stringstream ss; - senf::dumpPacketAnnotationRegistry(ss); BOOST_CHECK_EQUAL( ss.str(), "SENF_PACKET_ANNOTATION_SLOTS = 8\n" "SENF_PACKET_ANNOTATION_SLOTSIZE = 16\n" "TYPE FAST COMPLEX SIZE\n" - "(anonymous namespace)::ComplexAnnotation no yes 8\n" + "(anonymous namespace)::ComplexAnnotation no yes 32\n" "(anonymous namespace)::ComplexEmptyAnnotation no yes 1\n" "(anonymous namespace)::IntAnnotation yes no 4\n" "(anonymous namespace)::LargeAnnotation no no 32\n" ); -#endif } #ifdef COMPILE_CHECK