X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2F80211Bundle%2FWLANBeaconPacket.test.cc;h=a298f661f5fe05b6fec38ad06617a992e837004b;hb=e3179a2123ad51d0d9eb63834a581145c4f77c92;hp=d38d2ad7c21247b12c2ce438d8601ddb0f158f64;hpb=d827fa2c49602de3e7d9559810408f258b5987ba;p=senf.git diff --git a/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc b/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc index d38d2ad..a298f66 100644 --- a/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc +++ b/senf/Packets/80211Bundle/WLANBeaconPacket.test.cc @@ -30,9 +30,9 @@ #include #include -///////////////////////////////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 +58,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; @@ -71,14 +71,15 @@ BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_parse) BOOST_CHECK_EQUAL( i->type(), 0x07); //Country information ++i; //power constraint - BOOST_CHECK_EQUAL( i->type(), senf::WLANPowerConstraintInfoElementParser::TYPEID+0); + BOOST_CHECK_EQUAL( i->type(), senf::WLANPowerConstraintInfoElementParser::typeId+0); BOOST_CHECK( i->is()); senf::WLANPowerConstraintInfoElementParser ie ( i->as()); BOOST_CHECK_EQUAL( ie.value(), 0x42); ++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 +87,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() ); - 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 +119,7 @@ BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_create) data, data+sizeof(data) ); } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // Local Variables: