mirror of
https://github.com/mfontanini/libtins
synced 2026-01-26 12:01:34 +01:00
Added PDU::rfind_pdu.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <stdint.h>
|
||||
#include "ip.h"
|
||||
#include "tcp.h"
|
||||
#include "udp.h"
|
||||
#include "rawpdu.h"
|
||||
#include "pdu.h"
|
||||
#include "packet.h"
|
||||
@@ -15,6 +16,18 @@ class PDUTest : public testing::Test {
|
||||
public:
|
||||
};
|
||||
|
||||
TEST_F(PDUTest, FindPDU) {
|
||||
IP ip = IP("192.168.0.1") / TCP(22, 52) / RawPDU("Test");
|
||||
EXPECT_TRUE(ip.find_pdu<TCP>());
|
||||
EXPECT_TRUE(ip.find_pdu<RawPDU>());
|
||||
EXPECT_FALSE(ip.find_pdu<UDP>());
|
||||
TCP &t1 = ip.rfind_pdu<TCP>();
|
||||
const TCP &t2 = ip.rfind_pdu<TCP>();
|
||||
(void)t1;
|
||||
(void)t2;
|
||||
EXPECT_THROW(ip.rfind_pdu<UDP>(), pdu_not_found);
|
||||
}
|
||||
|
||||
TEST_F(PDUTest, OperatorConcat) {
|
||||
std::string raw_payload = "Test";
|
||||
IP ip = IP("192.168.0.1") / TCP(22, 52) / RawPDU(raw_payload);
|
||||
|
||||
Reference in New Issue
Block a user