Commit 7aab99f5 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fixed problem with updating the start position.

parent 758d023c
......@@ -8,7 +8,7 @@ void move_start(PrrtForwardPacketTable *fpt_ptr) {
while(1) {
which_byte = (uint16_t) (seqno / 32);
which_bit = (uint16_t) (seqno % 32);
if ((fpt_ptr->data[which_byte] >> which_bit) == 0) {
if (((fpt_ptr->data[which_byte] >> which_bit ) & 0x01) == 0) {
break;
}
fpt_ptr->data[which_byte] &= ~(1 << which_bit);
......
......@@ -54,4 +54,19 @@ TEST_F(ForwardPacketTableTest, ProperStop) {
}
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, seqno));
ASSERT_FALSE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 5));
}
TEST_F(ForwardPacketTableTest, Sequence) {
ASSERT_EQ(forwardPacketTable->start, 1);
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 4));
ASSERT_EQ(forwardPacketTable->start, 1);
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 7));
ASSERT_EQ(forwardPacketTable->start, 1);
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 1));
ASSERT_EQ(forwardPacketTable->start, 2);
ASSERT_FALSE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 4));
ASSERT_EQ(forwardPacketTable->start, 2);
ASSERT_TRUE(PrrtForwardPacketTable_test_set_is_number_relevant(forwardPacketTable, 8));
ASSERT_EQ(forwardPacketTable->start, 2);
}
\ 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