mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
@@ -244,8 +244,9 @@ public:
|
|||||||
* \param rhs The PDU to be moved.
|
* \param rhs The PDU to be moved.
|
||||||
*/
|
*/
|
||||||
PDU& operator=(PDU &&rhs) TINS_NOEXCEPT {
|
PDU& operator=(PDU &&rhs) TINS_NOEXCEPT {
|
||||||
|
delete inner_pdu_;
|
||||||
|
inner_pdu_ = 0;
|
||||||
std::swap(inner_pdu_, rhs.inner_pdu_);
|
std::swap(inner_pdu_, rhs.inner_pdu_);
|
||||||
rhs.inner_pdu_ = 0;
|
|
||||||
if (inner_pdu_) {
|
if (inner_pdu_) {
|
||||||
inner_pdu_->parent_pdu(this);
|
inner_pdu_->parent_pdu(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ TEST_F(PDUTest, OperatorConcatOnPacket) {
|
|||||||
EXPECT_TRUE(std::equal(raw->payload().begin(), raw->payload().end(), raw_payload.begin()));
|
EXPECT_TRUE(std::equal(raw->payload().begin(), raw->payload().end(), raw_payload.begin()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TINS_IS_CXX11
|
||||||
|
TEST_F(PDUTest, MoveAssignment) {
|
||||||
|
IP packet = IP("192.168.0.1") / TCP(22, 52);
|
||||||
|
packet = IP("1.2.3.4");
|
||||||
|
EXPECT_TRUE(packet.inner_pdu() == 0);
|
||||||
|
}
|
||||||
|
#endif // TINS_IS_CXX11
|
||||||
|
|
||||||
TEST_F(PDUTest, TinsCast) {
|
TEST_F(PDUTest, TinsCast) {
|
||||||
PDU* null_pdu = 0;
|
PDU* null_pdu = 0;
|
||||||
TCP tcp;
|
TCP tcp;
|
||||||
|
|||||||
Reference in New Issue
Block a user