switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Socket / Protocols / Raw / EUI64.test.cc
index 962804e..8ba3a35 100644 (file)
@@ -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 <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
-// 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 <g0dil@berlios.de>
 
 /** \file
     \brief EUI64.test unit tests */
 
 // Custom includes
 #include "EUI64.hh"
+#include <senf/Socket/Protocols/AddressExceptions.hh>
 
 #include <senf/Utils/auto_unit_test.hh>
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
-///////////////////////////////cc.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 
-BOOST_AUTO_UNIT_TEST(eui64)
+SENF_AUTO_UNIT_TEST(eui64)
 {
     senf::EUI64 eui;
     BOOST_CHECK( !eui );
@@ -53,18 +59,18 @@ BOOST_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 @@ BOOST_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 @@ BOOST_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_
 
 \f