// $Id$
//
// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@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
// Custom includes
#include "NetdeviceController.hh"
+#include "Protocols/Raw/MACAddress.hh"
#include "../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-BOOST_AUTO_UNIT_TEST(NetdeviceController)
-{
-// senf::NetdeviceController ctrl ("eth0");
-// std::cout << ctrl.hardwareAddress() << "\n";
+BOOST_AUTO_UNIT_TEST(NetdeviceController) {
+
+ senf::NetdeviceController ctrl ("lo");
+ BOOST_CHECK_EQUAL( ctrl.interfaceName(), "lo");
+
+ int oldMTU;
+ SENF_CHECK_NO_THROW( oldMTU = ctrl.mtu());
+
+ if (getuid() != 0) {
+ BOOST_WARN_MESSAGE(false, "Cannot run some tests of senf::NetdeviceController as non-root user");
+ return;
+ }
+
+ SENF_CHECK_NO_THROW( ctrl.mtu(oldMTU-16));
+ BOOST_CHECK_EQUAL( ctrl.mtu(), oldMTU-16);
+ SENF_CHECK_NO_THROW( ctrl.mtu(oldMTU));
+ BOOST_CHECK_EQUAL( ctrl.mtu(), oldMTU);
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-\f
+
// Local Variables:
// mode: c++
// fill-column: 100