some unimportant clean-ups ;)
[senf.git] / Packets / 80211Bundle / RadiotapPacket.test.cc
index f304f02..3a0cb0b 100644 (file)
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of non-inline non-template functions
+/** \file
+    \brief RadiotapPacket unit tests */
 
 // Custom includes
+#include "RadiotapPacket.hh"
 #include "../../Packets/Packets.hh"
+
 #include "../../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
-#include "RadiotapPacket.hh"
-
 
+///////////////////////////////cc.p////////////////////////////////////////
 BOOST_AUTO_UNIT_TEST(RadiotapPacket_packet)
 {
     /* used madwifi 0.9.4 */
     unsigned char data[] = {
             0x00 ,0x00 ,0x1a ,0x00, 0x6f, 0x18, 0x00, 0x00,
-            0x02, 0xe6, 0x8a, 0xdf, 0x12, 0x00,        0x00, 0x00,
+            0x02, 0xe6, 0x8a, 0xdf, 0x12, 0x00, 0x00, 0x00,
             0x12, 0x0c, 0xc8, 0x14, 0x40, 0x01, 0xc3, 0xa0,
             0x02, 0x23
     };
@@ -92,6 +94,9 @@ BOOST_AUTO_UNIT_TEST(RadiotapPacket_packet)
     BOOST_CHECK_EQUAL( p->channelOptions().staticTurbo(), false);
     BOOST_CHECK_EQUAL( p->channelOptions().halfRateChannel(), false);
     BOOST_CHECK_EQUAL( p->channelOptions().quarterRateChannel(), false);
+
+    std::ostringstream oss (std::ostringstream::out);
+    SENF_CHECK_NO_THROW( p.dump( oss));
 }
 
 BOOST_AUTO_UNIT_TEST(RadiotapPacket_create)
@@ -148,3 +153,25 @@ BOOST_AUTO_UNIT_TEST(RadiotapPacket_create)
     BOOST_CHECK_EQUAL( p->length(), 26u );
     BOOST_CHECK( equal( p.data().begin(), p.data().end(), data ));
 }
+
+BOOST_AUTO_UNIT_TEST(RadiotapPacket_packet_ath9k)
+{
+    /* radiotap packet from ath9k with atheros card*/
+    unsigned char data[] = {
+            0x00, 0x00, 0x20, 0x00, 0x6f, 0x48, 0x00, 0x00, 0x87, 0xbb, 0x91, 0x7c, 0x3b, 0x00, 0x00, 0x00,
+            0x00, 0x04, 0x85, 0x09, 0x80, 0x04, 0xb2, 0xa1, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x1a, 0xf7, 0x94
+    };
+    senf::RadiotapPacket p (senf::RadiotapPacket::create(data));
+
+    /* mandatory fields*/
+    BOOST_CHECK_EQUAL( p->version(), 0u);
+    BOOST_CHECK_EQUAL( p->length(), 32u);
+
+    BOOST_CHECK_EQUAL( p->dbmAntennaSignal(), -78);
+    BOOST_CHECK_EQUAL( p->dbmAntennaNoise(), -95);
+    BOOST_CHECK_EQUAL( p->fcs(), 0xd51af794);
+    BOOST_CHECK_EQUAL( p->antenna(), 0u);
+
+
+}
+