Basic support for frame prioritization; tests are failing

This commit is contained in:
Pavel Kirienko
2015-04-30 08:26:25 +03:00
parent eafcfa1733
commit 2843c0a35e
7 changed files with 288 additions and 48 deletions
@@ -260,13 +260,15 @@ TEST(TransferReceiver, UnterminatedTransfer)
uavcan::ITransferBufferManager& bufmgr = context.bufmgr;
uavcan::TransferBufferAccessor bk(context.bufmgr, RxFrameGenerator::DEFAULT_KEY);
const uint8_t MaxIndex = uavcan::Frame::getMaxIndexForTransferType(RxFrameGenerator::DEFAULT_KEY.getTransferType());
std::string content;
for (uint8_t i = 0; i <= uavcan::Frame::MaxIndex; i++)
for (uint8_t i = 0; i <= MaxIndex; i++)
{
CHECK_NOT_COMPLETE(rcv.addFrame(gen(1, "12345678", i, false, 0, 1000U + i), bk)); // Last one will be dropped
content += "12345678";
}
CHECK_COMPLETE(rcv.addFrame(gen(1, "12345678", uavcan::Frame::MaxIndex, true, 0, 1100), bk));
CHECK_COMPLETE(rcv.addFrame(gen(1, "12345678", MaxIndex, true, 0, 1100), bk));
ASSERT_EQ(1000, rcv.getLastTransferTimestampMonotonic().toUSec());
ASSERT_TRUE(matchBufferContent(bufmgr.access(gen.bufmgr_key), std::string(content, 2)));
ASSERT_EQ(0x3231, rcv.getLastTransferCrc());