X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FFileHandle.test.cc;h=60ba3ba60eab29eee968cede0ff5cac933db3532;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=93c15ea8291bcfc059ce6f9cceb4f6d2afd4ffbf;hpb=31d85cd6b8e03c5ecc924ca8892906be1bab702f;p=senf.git diff --git a/Socket/FileHandle.test.cc b/Socket/FileHandle.test.cc index 93c15ea..60ba3ba 100644 --- a/Socket/FileHandle.test.cc +++ b/Socket/FileHandle.test.cc @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// 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 @@ -20,7 +20,8 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// Unit tests +/** \file + \brief FileHandle unit tests */ //#include "FileHandle.test.hh" //#include "FileHandle.test.ih" @@ -31,7 +32,7 @@ #include #include "FileHandle.hh" -#include +#include "../Utils/auto_unit_test.hh" #include #define prefix_ @@ -45,13 +46,13 @@ namespace { FHandle(int fd) : senf::FileHandle(std::auto_ptr( new senf::FileBody(fd))) {} - FHandle(std::string name) + FHandle(std::string const & name) : senf::FileHandle(std::auto_ptr( new senf::FileBody())) { int rv = ::open(name.c_str(),O_RDWR|O_NONBLOCK) ; if (rv<0) - throw senf::SystemException(errno); + throw senf::SystemException(); fd(rv); } }; @@ -73,9 +74,9 @@ BOOST_AUTO_UNIT_TEST(fileHandle) BOOST_CHECK_EQUAL(fh.fd(), fh2.fd()); BOOST_CHECK(fh.writeable()); - BOOST_CHECK_NO_THROW(fh.close()); + SENF_CHECK_NO_THROW(fh.close()); BOOST_CHECK_THROW(fh.close(),senf::SystemException); - BOOST_CHECK_NO_THROW(fh.terminate()); + SENF_CHECK_NO_THROW(fh.terminate()); } { @@ -97,6 +98,7 @@ BOOST_AUTO_UNIT_TEST(fileHandle) if (fcntl(fds[1],F_SETFL,flags|O_NONBLOCK) == -1) BOOST_FAIL(strerror(errno)); char buffer[1024]; + ::memset(buffer, 0, sizeof(buffer)); while (write(fds[1],buffer,1024) == 1024) ; FHandle fh2(fds[1]); @@ -119,4 +121,5 @@ BOOST_AUTO_UNIT_TEST(fileHandle) // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" +// comment-column: 40 // End: