Commit 05b315f8 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fix case where stop returns to 0.

parent 7aab99f5
...@@ -31,7 +31,7 @@ int PrrtForwardPacketTable_test_set_is_number_relevant(PrrtForwardPacketTable *f ...@@ -31,7 +31,7 @@ int PrrtForwardPacketTable_test_set_is_number_relevant(PrrtForwardPacketTable *f
uint16_t stop = (uint16_t) (SEQNO_SPACE / 2 + fpt_ptr->start); uint16_t stop = (uint16_t) (SEQNO_SPACE / 2 + fpt_ptr->start);
if (fpt_ptr->start < stop && !(fpt_ptr->start <= seqno && seqno <= stop)) { if (fpt_ptr->start < stop && !(fpt_ptr->start <= seqno && seqno <= stop)) {
return FALSE; return FALSE;
} else if (!(seqno < stop)) { } else if (!(seqno <= stop || fpt_ptr->start <= seqno)) {
return FALSE; return FALSE;
} else { } else {
uint16_t which_byte = (uint16_t) (seqno / 32); uint16_t which_byte = (uint16_t) (seqno / 32);
......
...@@ -69,4 +69,12 @@ TEST_F(ForwardPacketTableTest, Sequence) { ...@@ -69,4 +69,12 @@ TEST_F(ForwardPacketTableTest, Sequence) {
ASSERT_EQ(forwardPacketTable->start, 2); ASSERT_EQ(forwardPacketTable->start, 2);
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 8)); ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 8));
ASSERT_EQ(forwardPacketTable->start, 2); ASSERT_EQ(forwardPacketTable->start, 2);
}
TEST_F(ForwardPacketTableTest, ResetToZero) {
for (int i = 1; i < pow(2, 16) + 5; ++i) {
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, i));
ASSERT_FALSE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, i));
}
} }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment