switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Packets / 80211Bundle / WLANBeaconPacket.test.cc
index 13dce87..a12b938 100644 (file)
@@ -2,24 +2,29 @@
 //
 // Copyright (C) 2009
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
-//     Christian Niephaus <cni@berlios.de>
-//     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
-// 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):
+//   Thorsten Horstmann <tho@berlios.de>
+//   Christian Niephaus <cni@berlios.de>
 
 /** \file
     \brief 802.11 WLAN Beacon Packet unit tests */
@@ -30,9 +35,9 @@
 #include <senf/Utils/auto_unit_test.hh>
 #include <boost/test/test_tools.hpp>
 
-///////////////////////////////cc.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 
-BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_parse)
+SENF_AUTO_UNIT_TEST(WLANBeaconPacket_parse)
 {
     unsigned char data[] = {
         0x3a, 0x30, 0xaa, 0x4c, 0x9c, 0x00, 0x00, 0x00, //timestamp
@@ -58,11 +63,11 @@ BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_parse)
     BOOST_CHECK_EQUAL( p->ssidIE().length(), 5);
     BOOST_CHECK_EQUAL( p->ssidIE().value().value(), "boxC1");
     BOOST_CHECK_EQUAL( p->ssid().value(), "boxC1");
-    
+
     typedef senf::WLANBeaconPacket::Parser::ieList_t::container ieListContainer_t;
     ieListContainer_t ieListContainer (p->ieList());
     BOOST_CHECK_EQUAL( ieListContainer.size(), 5);
-    
+
     ieListContainer_t::iterator i ( ieListContainer.begin());
     BOOST_CHECK_EQUAL( i->type(), 0x03); //DS parameter set
     ++i;
@@ -78,7 +83,8 @@ BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_parse)
     ++i;
     BOOST_CHECK_EQUAL( i->type(), 0xdd); //vendor specific
     BOOST_CHECK_EQUAL( i->length(), 0x18);
-    BOOST_CHECK_EQUAL( boost::size(i->value()), 0x18);    
+    BOOST_CHECK_EQUAL( boost::size(i->value()), 0x18);
+
     unsigned char value[] = {
             0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x88, 0x00,
             0x02, 0xa3, 0x00, 0x00, 0x27, 0xa4, 0x00, 0x00,
@@ -86,23 +92,26 @@ BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_parse)
     };
     SENF_CHECK_EQUAL_COLLECTIONS( value, value+sizeof(value),
             boost::begin(i->value()), boost::end(i->value()) );
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss ));
 }
 
-BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_create)
+SENF_AUTO_UNIT_TEST(WLANBeaconPacket_create)
 {
     senf::WLANBeaconPacket p (senf::WLANBeaconPacket::create());
     p->timestamp() << 0x0000009C4CAA303AuLL;
     p->beaconInterval() << 100u;
     p->ssidIE().value() << "boxC1";
-    
+
     typedef senf::WLANBeaconPacket::Parser::ieList_t::container ieListContainer_t;
     ieListContainer_t ieListContainer (p->ieList());
     senf::WLANPowerConstraintInfoElementParser ie (
             ieListContainer.push_back_space().init<senf::WLANPowerConstraintInfoElementParser>() );
-    ie.value() << 0x42;    
-    
+    ie.value() << 0x42;
+
     p.finalizeThis();
-    
+
     unsigned char data[] = {
         0x3a, 0x30, 0xaa, 0x4c, 0x9c, 0x00, 0x00, 0x00, //timestamp
         0x64, 0x00, //beacon interval
@@ -115,7 +124,7 @@ BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_create)
             data, data+sizeof(data) );
 }
 
-///////////////////////////////cc.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 
 \f
 // Local Variables: