Add "unfixable" ByteTagList test case

This test case creates empty packet, removes last 50 bytes and
adds them back.

As packet is empty initially, no bytes are marked dirty.  Therefore,
Buffer::AddAtEnd returns false, indicating that added bytes were not used
before.  However, it does not know if they were tagged with byte tags.

This bug is not so easy to fix as Buffer does not have enough information
to return true in Buffer::AddAtEnd when it should.
This commit is contained in:
Alexander Krotov
2015-07-26 19:44:31 +03:00
parent 8f515dcc03
commit b0577a2eac

View File

@@ -568,6 +568,20 @@ PacketTest::DoRun (void)
tmp->AddPaddingAtEnd (50);
CHECK (tmp, 1, E (25, 0, 50));
}
/* Test reducing tagged packet size and increasing it back,
* now using padding bytes to avoid triggering dirty state
* in virtual buffer
*/
{
Ptr<Packet> tmp = Create<Packet> (100);
tmp->AddByteTag (ATestTag<25> ());
CHECK (tmp, 1, E (25, 0, 100));
tmp->RemoveAtEnd (50);
CHECK (tmp, 1, E (25, 0, 50));
tmp->AddPaddingAtEnd (50);
CHECK (tmp, 1, E (25, 0, 50));
}
}
//--------------------------------------
class PacketTagListTest : public TestCase