X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fhexdump.test.cc;fp=Socket%2FProtocols%2FGenericSockAddr.cci;h=ac64f5fc0622f9ee1152691b06230b7b8f5fc1a1;hb=a9fd0471a3ca128c626a6771c4518f33ef78f053;hp=3aa05af4e949b73c2f305f88449df71347275139;hpb=c3e26baef92c53af9826c2af3bfe4f3570c634bd;p=senf.git diff --git a/Socket/Protocols/GenericSockAddr.cci b/Utils/hexdump.test.cc similarity index 64% rename from Socket/Protocols/GenericSockAddr.cci rename to Utils/hexdump.test.cc index 3aa05af..ac64f5f 100644 --- a/Socket/Protocols/GenericSockAddr.cci +++ b/Utils/hexdump.test.cc @@ -1,4 +1,6 @@ -// Copyright (C) 2007 +// $Id$ +// +// Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -19,43 +21,39 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief GenericSockAddr inline non-template implementation */ - -// Custom includes + \brief hexdump.test unit tests */ -#define prefix_ inline -///////////////////////////////cci.p/////////////////////////////////////// +//#include "hexdump.test.hh" +//#include "hexdump.test.ih" -prefix_ senf::GenericSockAddr::GenericSockAddr() -{} +// Custom includes +#include "hexdump.hh" +#include -prefix_ struct sockaddr * senf::GenericSockAddr::sockaddr_p() -{ - return reinterpret_cast(&addr_); -} +#include +#include -prefix_ struct sockaddr const * senf::GenericSockAddr::sockaddr_p() - const -{ - return reinterpret_cast(&addr_); -} +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// -prefix_ unsigned senf::GenericSockAddr::sockaddr_len() - const +BOOST_AUTO_UNIT_TEST(hExDuMp) { - return sizeof(addr_); + char data[] = { 0x18, 0x19, 0x20, 0x21, 0x7c, 0x7d, 0x7e, 0x7f }; + std::stringstream s; + senf::hexdump(data, data+sizeof(data), s, 8); + BOOST_CHECK_EQUAL( s.str(), " 0000 18 19 20 21 7c 7d 7e 7f .. ! |}..\n" ); } -///////////////////////////////cci.e/////////////////////////////////////// +///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 +// comment-column: 40 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" -// comment-column: 40 // End: