X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketImpl.test.cc;h=3026468737943854f25ae200c341a30b3a6db7c2;hb=6116cb96ea7bdcb42b7d12165a05fcbe0687226d;hp=e4e5bcbaec26fb716e282c2595bea0a59039edc7;hpb=2d6585ff852e9d282c17003ba1db0b73eb3a8500;p=senf.git diff --git a/Packets/PacketImpl.test.cc b/Packets/PacketImpl.test.cc index e4e5bcb..3026468 100644 --- a/Packets/PacketImpl.test.cc +++ b/Packets/PacketImpl.test.cc @@ -1,3 +1,5 @@ +// $Id$ +// // Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) @@ -28,7 +30,7 @@ #include "Packets.hh" #include "main.test.hh" -#include +#include "../Utils/auto_unit_test.hh" #include #define prefix_ @@ -48,8 +50,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) BOOST_CHECK_EQUAL(p->refcount(), 0); p->add_ref(); BOOST_CHECK_EQUAL(p->refcount(), 1); +#ifndef NDEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 1u); +#endif // From now on, the object should stay alive since I manually incremented the // refcount .. @@ -65,8 +69,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) p,p->begin(),p->end(), senf::PacketInterpreterBase::Append)); // Hmm ... this check works as long as sizeof(PacketInterpreterBase> != // sizeof(PacketImpl) ... !! +#ifndef NDEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin< senf::PacketInterpreter >::allocCounter(), 1u); +#endif senf::PacketInterpreterBase::ptr pi2 (pi); BOOST_CHECK_EQUAL(p->refcount(), 3); } @@ -78,8 +84,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) p->truncateInterpreters(pi.get()); BOOST_CHECK_EQUAL(p->refcount(),1); } +#ifndef NDEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 0u); +#endif BOOST_CHECK_EQUAL(p->refcount(),1); @@ -87,8 +95,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) // Therefore we can safely delete the object. BOOST_CHECK_EQUAL(p->refcount(), 1); p->release(); +#ifndef NDEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 0u); +#endif } BOOST_AUTO_UNIT_TEST(packetImpl_data) @@ -191,8 +201,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_interpreters) BOOST_CHECK_EQUAL(p->refcount(), 1); p->release(); +#ifndef NDEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 0u); +#endif } ///////////////////////////////cc.e////////////////////////////////////////