Skip to content

Commit

Permalink
Updated UT to test that the first packet isn't erroneously marked as …
Browse files Browse the repository at this point in the history
…a duplicate
  • Loading branch information
DJKessler committed Nov 7, 2024
1 parent 1915264 commit 23fce43
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Svc/FileUplink/test/ut/FileUplinkTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,30 @@ namespace Svc {
);
ASSERT_EVENTS_SIZE(0);

// Simulate duplication of packet 0
--this->sequenceIndex;
ASSERT_EQ(0, component.m_lastSequenceIndex);
ASSERT_EQ(1, this->sequenceIndex);
ASSERT_EQ(Os::File::MAX_STATUS, component.m_lastPacketWriteStatus);

// Send data packet 1
const size_t byteOffset = 0;
this->sendDataPacket(byteOffset, packetData);
ASSERT_TLM_SIZE(1);
ASSERT_TLM_PacketsReceived(
0,
++this->expectedPacketsReceived
);
ASSERT_TLM_Warnings_SIZE(0);

// capture the checksum after sending the first packet
const ::CFDP::Checksum expectedChecksum(component.m_file.m_checksum);

// Send the data packet (packet 0) again
const size_t byteOffset = 0;
// Simulate duplication of packet 1
--this->sequenceIndex;

ASSERT_EQ(this->sequenceIndex, component.m_lastSequenceIndex);
ASSERT_EQ(Os::File::OP_OK, component.m_lastPacketWriteStatus);

// Send data packet 1 again
this->sendDataPacket(byteOffset, packetData);
ASSERT_TLM_SIZE(2);
ASSERT_TLM_PacketsReceived(
Expand Down

0 comments on commit 23fce43

Please sign in to comment.