X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FNetdeviceController.test.cc;h=649cb0232ae5a08328c0690360d78f52d4d44971;hb=294845be2d7bd75cd01d269d7fe4ab498f379d1c;hp=825afeb6b9877a98a7fc5c9f5c2cf855fcdadbd9;hpb=6d527cd9cf4d928926e5bf164ea470eb419fcbf8;p=senf.git diff --git a/Socket/NetdeviceController.test.cc b/Socket/NetdeviceController.test.cc index 825afeb..649cb02 100644 --- a/Socket/NetdeviceController.test.cc +++ b/Socket/NetdeviceController.test.cc @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Thorsten Horstmann +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Thorsten Horstmann // // 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 @@ -27,6 +27,7 @@ // Custom includes #include "NetdeviceController.hh" +#include "Protocols/Raw/MACAddress.hh" #include "../Utils/auto_unit_test.hh" #include @@ -34,16 +35,29 @@ #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; + BOOST_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; + } + + BOOST_CHECK_NO_THROW( ctrl.mtu(oldMTU-16)); + BOOST_CHECK_EQUAL( ctrl.mtu(), oldMTU-16); + BOOST_CHECK_NO_THROW( ctrl.mtu(oldMTU)); + BOOST_CHECK_EQUAL( ctrl.mtu(), oldMTU); } ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ - + // Local Variables: // mode: c++ // fill-column: 100