mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 13:34:27 +01:00
Added some Dot11 tests, fixed bugs.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
using Tins::Dot11;
|
||||
using Tins::Dot11ManagementFrame;
|
||||
using Tins::Dot11Data;
|
||||
|
||||
typedef Dot11ManagementFrame::CapabilityInformation CapabilityInformation;
|
||||
|
||||
@@ -33,6 +34,16 @@ inline void test_equals(const Dot11ManagementFrame& b1, const Dot11ManagementFra
|
||||
test_equals(static_cast<const Dot11&>(b1), static_cast<const Dot11&>(b2));
|
||||
}
|
||||
|
||||
inline void test_equals(const Dot11Data& b1, const Dot11Data& b2) {
|
||||
EXPECT_EQ(b1.addr2(), b2.addr2());
|
||||
EXPECT_EQ(b1.addr3(), b2.addr3());
|
||||
EXPECT_EQ(b1.addr4(), b2.addr4());
|
||||
EXPECT_EQ(b1.frag_num(), b2.frag_num());
|
||||
EXPECT_EQ(b1.seq_num(), b2.seq_num());
|
||||
|
||||
test_equals(static_cast<const Dot11&>(b1), static_cast<const Dot11&>(b2));
|
||||
}
|
||||
|
||||
inline void test_equals(const CapabilityInformation &info1, const CapabilityInformation &info2) {
|
||||
EXPECT_EQ(info1.ess(), info2.ess());
|
||||
EXPECT_EQ(info1.ibss(), info2.ibss());
|
||||
@@ -68,6 +79,15 @@ inline void test_equals_expected(const Dot11ManagementFrame &dot11) {
|
||||
EXPECT_EQ(dot11.addr3(), "02:03:04:05:06:07");
|
||||
}
|
||||
|
||||
inline void test_equals_expected(const Dot11Data &dot11) {
|
||||
EXPECT_EQ(dot11.type(), Dot11::DATA);
|
||||
EXPECT_EQ(dot11.addr1(), "00:01:02:03:04:05");
|
||||
EXPECT_EQ(dot11.addr2(), "01:02:03:04:05:06");
|
||||
EXPECT_EQ(dot11.addr3(), "02:03:04:05:06:07");
|
||||
EXPECT_EQ(dot11.frag_num(), 0xa);
|
||||
EXPECT_EQ(dot11.seq_num(), 0xf1d);
|
||||
}
|
||||
|
||||
inline void test_equals_empty(const Dot11 &dot11) {
|
||||
Dot11::address_type empty_addr;
|
||||
|
||||
@@ -96,6 +116,16 @@ inline void test_equals_empty(const Dot11ManagementFrame &dot11) {
|
||||
test_equals_empty(static_cast<const Dot11 &>(dot11));
|
||||
}
|
||||
|
||||
inline void test_equals_empty(const Dot11Data &dot11) {
|
||||
Dot11::address_type empty_addr;
|
||||
|
||||
EXPECT_EQ(dot11.addr1(), empty_addr);
|
||||
EXPECT_EQ(dot11.addr2(), empty_addr);
|
||||
EXPECT_EQ(dot11.addr3(), empty_addr);
|
||||
EXPECT_EQ(dot11.frag_num(), 0);
|
||||
EXPECT_EQ(dot11.seq_num(), 0);
|
||||
}
|
||||
|
||||
inline void test_equals_empty(const CapabilityInformation &info) {
|
||||
EXPECT_EQ(info.ess(), 0);
|
||||
EXPECT_EQ(info.ibss(), 0);
|
||||
|
||||
Reference in New Issue
Block a user