X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FPacketData.test.cc;h=957e78305aceead267de1348960d901e743b33d2;hb=refs%2Fheads%2Fmaster;hp=76806f627bb8b8ac61e4404e39f7410d085d50de;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Packets/PacketData.test.cc b/senf/Packets/PacketData.test.cc index 76806f6..957e783 100644 --- a/senf/Packets/PacketData.test.cc +++ b/senf/Packets/PacketData.test.cc @@ -2,23 +2,28 @@ // // 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 -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. +// The contents of this file are subject to the Fraunhofer FOKUS Public License +// Version 1.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// http://senf.berlios.de/license.html // -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// The Fraunhofer FOKUS Public License Version 1.0 is based on, +// but modifies the Mozilla Public License Version 1.1. +// See the full license text for the amendments. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the License. +// +// The Original Code is Fraunhofer FOKUS code. +// +// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. +// (registered association), Hansastraße 27 c, 80686 Munich, Germany. +// All Rights Reserved. +// +// Contributor(s): +// Stefan Bund /** \file \brief PacketData unit tests */ @@ -29,17 +34,17 @@ // Custom includes #include "Packets.hh" -#include "../Utils/auto_unit_test.hh" +#include #include #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace { struct VoidPacket : public senf::PacketTypeBase {}; } -BOOST_AUTO_UNIT_TEST(packetData) +SENF_AUTO_UNIT_TEST(packetData) { // We cannot simply allocate a packetData instance .. we must go through PacketInterpreterBase // and PacketImpl. @@ -47,23 +52,23 @@ BOOST_AUTO_UNIT_TEST(packetData) senf::PacketInterpreterBase::ptr pi (senf::PacketInterpreter::create()); senf::PacketData & d (pi->data());\ - + BOOST_CHECK( d.begin() == d.end() ); BOOST_CHECK_EQUAL( d.size(), 0u ); BOOST_CHECK( d.empty() ); - + d.insert(d.begin(), 0xabu); BOOST_CHECK_EQUAL( d.size(), 1u ); BOOST_CHECK_EQUAL( d[0], 0xabu ); BOOST_CHECK( !d.empty() ); - + d.insert(d.begin(), 10, 0xcdu ); BOOST_CHECK_EQUAL( d.size(), 11u ); BOOST_CHECK_EQUAL( d[0], 0xcdu ); BOOST_CHECK_EQUAL( d[9], 0xcdu ); BOOST_CHECK_EQUAL( d[10], 0xabu ); - senf::PacketData::byte data[] = + senf::PacketData::byte data[] = { 0xf0u, 0xf1u, 0xf2u, 0xf3u, 0xf4u, 0xf5u, 0xf6u, 0xf7u }; d.insert(d.begin()+5, data, data+sizeof(data)/sizeof(data[0])); BOOST_CHECK_EQUAL( d.size(), 19u ); @@ -74,7 +79,7 @@ BOOST_AUTO_UNIT_TEST(packetData) d.erase(d.begin()); BOOST_CHECK_EQUAL( d.size(), 18u ); BOOST_CHECK_EQUAL( d[4], 0xf0u ); - + d.erase(d.begin(), d.begin()+11); BOOST_CHECK_EQUAL( d.size(), 7u ); BOOST_CHECK_EQUAL( d[0], 0xf7u ); @@ -93,7 +98,7 @@ BOOST_AUTO_UNIT_TEST(packetData) BOOST_CHECK( d.empty() ); } -BOOST_AUTO_UNIT_TEST(safePacketIterator) +SENF_AUTO_UNIT_TEST(safePacketIterator) { // We cannot simply allocate a packetData instance .. we must go through PacketInterpreterBase // and PacketImpl. @@ -111,7 +116,7 @@ BOOST_AUTO_UNIT_TEST(safePacketIterator) BOOST_CHECK( i == senf::safe_data_iterator(d,d.begin()) ); BOOST_CHECK( senf::PacketData::iterator(i) == d.begin() ); - senf::PacketData::byte data[] = + senf::PacketData::byte data[] = { 0xf0u, 0xf1u, 0xf2u, 0xf3u, 0xf4u, 0xf5u, 0xf6u, 0xf7u }; d.resize(sizeof(data)/sizeof(data[0])); BOOST_CHECK( senf::PacketData::iterator(i) == d.begin() ); @@ -119,7 +124,7 @@ BOOST_AUTO_UNIT_TEST(safePacketIterator) BOOST_CHECK_EQUAL( d.size(), sizeof(data)/sizeof(data[0]) ); BOOST_CHECK_EQUAL( *(i+sizeof(data)/sizeof(data[0])-1), 0xf7u ); - BOOST_CHECK_EQUAL( std::distance(i,senf::safe_data_iterator(d,d.end())), + BOOST_CHECK_EQUAL( std::distance(i,senf::safe_data_iterator(d,d.end())), senf::PacketData::difference_type(d.size()) ); *(++i) = 0x01u; BOOST_CHECK_EQUAL( d[1], 0x01u ); @@ -128,7 +133,7 @@ BOOST_AUTO_UNIT_TEST(safePacketIterator) BOOST_CHECK( &d == &i.data() ); } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_