From: g0dil Date: Wed, 11 Aug 2010 22:31:03 +0000 (+0000) Subject: Packets: Fix annotation unit-test on 64bit architectures X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=84f14a42f9993e186c7897ce0db021300e0a2d48;p=senf.git Packets: Fix annotation unit-test on 64bit architectures git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1678 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/Packet.test.cc b/senf/Packets/Packet.test.cc index 2dafae1..72e0569 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 ); @@ -345,7 +352,7 @@ SENF_AUTO_UNIT_TEST(packetAnnotation) "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" );