Socket: fixed bug in readfrom where socklen was not set
[senf.git] / Socket / Protocols / Raw / PacketSocketHandle.test.cc
index f579885..78d5476 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
 //
 // 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
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Unit tests
+/** \file
+    \brief PacketSocketHandle unit tests */
 
 //#include "PacketSocketHandle.test.hh"
 //#include "PacketSocketHandle.test.ih"
 
-#include "PacketSocketHandle.hh"
-
 // Custom includes
 #include <iostream>
 #include <unistd.h>
+#include "PacketSocketHandle.hh"
 
-#include <boost/test/auto_unit_test.hpp>
+#include "../../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
@@ -48,19 +48,22 @@ BOOST_AUTO_UNIT_TEST(packetSocketHandle)
     {
         senf::PacketSocketHandle sock;
 
-        BOOST_CHECK_NO_THROW( sock.bind(senf::LLSocketAddress("eth0")) );
+        SENF_CHECK_NO_THROW( sock.bind(senf::LLSocketAddress("eth0")) );
         senf::LLSocketAddress a;
-        BOOST_CHECK_NO_THROW( sock.local(a) );
+        SENF_CHECK_NO_THROW( sock.local(a) );
         BOOST_CHECK_EQUAL( a.interface(), "eth0" );
 
         // How am I supposed to test read and write .. grmpf ..
 
-        BOOST_CHECK_NO_THROW( sock.protocol().mcAdd(
-                                  "eth0",senf::llAddress("01-02-03-04-05-06")) );
-        BOOST_CHECK_NO_THROW( sock.protocol().mcDrop(
-                                  "eth0",senf::llAddress("01-02-03-04-05-06")) );
+        SENF_CHECK_NO_THROW( sock.protocol().mcAdd(
+                "eth0", senf::MACAddress::from_string("01-02-03-04-05-06")) );
+        SENF_CHECK_NO_THROW( sock.protocol().mcDrop(
+                "eth0", senf::MACAddress::from_string("01-02-03-04-05-06")) );
 
-        BOOST_CHECK_NO_THROW( sock.protocol().available() );
+        SENF_CHECK_NO_THROW( sock.protocol().promisc( "eth0", true) );
+        SENF_CHECK_NO_THROW( sock.protocol().promisc( "eth0", false));
+                
+        SENF_CHECK_NO_THROW( sock.protocol().available() );
         BOOST_CHECK( ! sock.eof() );
     }
 }