X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FSocket%2FProtocols%2FRaw%2FEUI64.test.cc;h=8ba3a35882c8f67053900b3a75dd98b02b9e56ca;hb=ab7ff164ab5ae711ec09ce2b24228510f1ffdcff;hp=08429a320ed02291fa4e276e0d95713016808c71;hpb=767a76da8e5b96a69b620e44d32e0a1b04005679;p=senf.git diff --git a/senf/Socket/Protocols/Raw/EUI64.test.cc b/senf/Socket/Protocols/Raw/EUI64.test.cc index 08429a3..8ba3a35 100644 --- a/senf/Socket/Protocols/Raw/EUI64.test.cc +++ b/senf/Socket/Protocols/Raw/EUI64.test.cc @@ -1,24 +1,29 @@ // $Id$ // -// Copyright (C) 2009 +// Copyright (C) 2009 // 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 -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. +// The contents of this file are subject to the Fraunhofer FOKUS Public License +// Version 1.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// http://senf.berlios.de/license.html // -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// The Fraunhofer FOKUS Public License Version 1.0 is based on, +// but modifies the Mozilla Public License Version 1.1. +// See the full license text for the amendments. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the License. +// +// The Original Code is Fraunhofer FOKUS code. +// +// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. +// (registered association), Hansastraße 27 c, 80686 Munich, Germany. +// All Rights Reserved. +// +// Contributor(s): +// Stefan Bund /** \file \brief EUI64.test unit tests */ @@ -28,12 +33,13 @@ // Custom includes #include "EUI64.hh" +#include #include #include #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// SENF_AUTO_UNIT_TEST(eui64) { @@ -53,18 +59,18 @@ SENF_AUTO_UNIT_TEST(eui64) BOOST_CHECK_EQUAL( eui, senf::EUI64::from_data(data) ); BOOST_CHECK_EQUAL( eui, senf::EUI64::from_string("10:20:30:ff-FE:40:50:60") ); - BOOST_CHECK_THROW( senf::EUI64::from_string("123:20:30:40:50:60:70:80"), + BOOST_CHECK_THROW( senf::EUI64::from_string("123:20:30:40:50:60:70:80"), senf::AddressSyntaxException ); - BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70"), + BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70"), senf::AddressSyntaxException ); - BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:8g"), + BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:8g"), senf::AddressSyntaxException ); - BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:80:90"), + BOOST_CHECK_THROW( senf::EUI64::from_string("12:20:30:40:50:60:70:80:90"), senf::AddressSyntaxException ); - + BOOST_CHECK_EQUAL( senf::EUI64::None, senf::EUI64(0) ); BOOST_CHECK(! senf::EUI64::None ); - + { std::stringstream ss; ss << std::uppercase << eui; @@ -73,7 +79,7 @@ SENF_AUTO_UNIT_TEST(eui64) BOOST_CHECK( !eui ); ss >> eui; BOOST_CHECK_EQUAL( eui, senf::EUI64(0x102030fffe405060ull) ); - + BOOST_CHECK( (ss >> eui).fail() ); } @@ -84,7 +90,17 @@ SENF_AUTO_UNIT_TEST(eui64) } } -///////////////////////////////cc.e//////////////////////////////////////// +SENF_AUTO_UNIT_TEST(eui64_fillRight) +{ + std::string eui64Str ("01:02:03:ff-fe:04:05:06"); + senf::EUI64 eui64 (senf::EUI64::from_string( eui64Str)); + + std::stringstream ss; + ss << std::left << eui64; + BOOST_CHECK_EQUAL( ss.str(), eui64Str); +} + +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_