Commit e6e6564a authored by Andreas Schmidt's avatar Andreas Schmidt

Add test for (1,1) code.

parent eac69607
Pipeline #862 canceled with stages
in 9 minutes and 45 seconds
......@@ -109,8 +109,8 @@ void *send_data_loop(void *ptr)
PrrtBlock_encode(block, &sock_ptr->sequenceNumberRedundancy);
PrrtTimeStampCycle(sock_ptr, ts_data_packet, packetToSend->sequenceNumber, PrrtEncodeEnd);
uint32_t redundancyBlocks = List_count(block->redundancyPackets);
for(j = 0; j < redundancyBlocks; j++) {
uint32_t redundancyPackets = List_count(block->redundancyPackets);
for(j = 0; j < redundancyPackets; j++) {
PrrtPacket *red_pkt = PrrtBlock_get_first_red_data(block);
send_packet(sock_ptr, red_pkt);
}
......
......@@ -152,3 +152,42 @@ TEST_F(PrrtBlockTest, EncodeDecode)
ASSERT_STREQ(s1, s2);
}
}
TEST_F(PrrtBlockTest, NoCodingConfigured)
{
PrrtCodingParams *cpar = PrrtCodingParams_create();
PrrtCodingParams_update(cpar, 1, 1);
PrrtBlock *encBlock = PrrtBlock_create(cpar, 1);
PrrtBlock *decBlock = PrrtBlock_create(cpar, 1);
PrrtCodingParams_destroy(cpar);
prrtSequenceNumber_t base = 1;
PrrtPacket *packets[1];
PrrtPacket *refPackets[1];
for(uint32_t i = 0; i < 1; i++) {
char data[3];
sprintf(data, "%d", i);
packets[i] = PrrtPacket_create_data_packet(0, data, (prrtPacketLength_t) strlen(data), i + 1, 0);
packets[i]->index = (uint8_t) i;
refPackets[i] = PrrtPacket_create_data_packet(0, data, (prrtPacketLength_t) strlen(data), i + 1, 0);
ASSERT_TRUE(PrrtBlock_insert_data_packet(encBlock, packets[i]));
}
// ENCODING
ASSERT_TRUE(PrrtBlock_encode_ready(encBlock));
uint32_t j = 0;
PrrtBlock_encode(encBlock, &base);
uint32_t pkt_count = List_count(encBlock->dataPackets);
for(j = 0; j < pkt_count; j++) {
PrrtPacket *data_pkt = PrrtBlock_get_first_data(encBlock);
ASSERT_EQ(refPackets[j]->sequenceNumber, data_pkt->sequenceNumber);
}
uint32_t red_count = List_count(encBlock->redundancyPackets);
ASSERT_EQ(red_count, 0);
PrrtBlock_destroy(encBlock);
PrrtBlock_destroy(decBlock);
}
Markdown is supported
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