X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketImpl.test.cc;h=649bd0f926747f50a6ec862d17130c27f9332824;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=0c62174168f1a5ff52fc816fb6ebc6b034333ac9;hpb=47368f306a577d1e46df69a7f729bd3893cbe5e7;p=senf.git diff --git a/Packets/PacketImpl.test.cc b/Packets/PacketImpl.test.cc index 0c62174..649bd0f 100644 --- a/Packets/PacketImpl.test.cc +++ b/Packets/PacketImpl.test.cc @@ -1,6 +1,8 @@ -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// $Id$ +// +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -19,18 +21,16 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief PacketImpl.test unit tests */ + \brief PacketImpl unit tests */ //#include "PacketImpl.test.hh" //#include "PacketImpl.test.ih" // Custom includes -#include "PacketImpl.hh" -#include "PacketInterpreter.hh" -#include "PacketType.hh" +#include "Packets.hh" #include "main.test.hh" -#include +#include "../Utils/auto_unit_test.hh" #include #define prefix_ @@ -50,8 +50,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) BOOST_CHECK_EQUAL(p->refcount(), 0); p->add_ref(); BOOST_CHECK_EQUAL(p->refcount(), 1); +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 1u); +#endif // From now on, the object should stay alive since I manually incremented the // refcount .. @@ -67,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) ... !! +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin< senf::PacketInterpreter >::allocCounter(), 1u); +#endif senf::PacketInterpreterBase::ptr pi2 (pi); BOOST_CHECK_EQUAL(p->refcount(), 3); } @@ -80,8 +84,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) p->truncateInterpreters(pi.get()); BOOST_CHECK_EQUAL(p->refcount(),1); } +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 0u); +#endif BOOST_CHECK_EQUAL(p->refcount(),1); @@ -89,8 +95,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_mem) // Therefore we can safely delete the object. BOOST_CHECK_EQUAL(p->refcount(), 1); p->release(); +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 0u); +#endif } BOOST_AUTO_UNIT_TEST(packetImpl_data) @@ -193,8 +201,10 @@ BOOST_AUTO_UNIT_TEST(packetImpl_interpreters) BOOST_CHECK_EQUAL(p->refcount(), 1); p->release(); +#ifdef SENF_DEBUG BOOST_CHECK_EQUAL( senf::pool_alloc_mixin::allocCounter(), 0u); +#endif } ///////////////////////////////cc.e//////////////////////////////////////// @@ -207,4 +217,6 @@ BOOST_AUTO_UNIT_TEST(packetImpl_interpreters) // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: