Fix rlc_am_data_test to avoid compiler warning from memset

master
Pedro Alvarez 6 years ago committed by Andre Puschmann
parent 3a502ccd13
commit f2530eb57b

@ -51,9 +51,10 @@ uint32_t PDU4_LEN = 5;
using namespace srslte;
int main(int argc, char **argv) {
void test1()
{
srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1,b2;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu1[0], PDU1_LEN);
b1.N_bytes = PDU1_LEN;
@ -68,12 +69,14 @@ int main(int argc, char **argv) {
assert(6 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU1_LEN);
for(uint32_t i=0;i<b2.N_bytes;i++)
for (uint32_t i = 0; i < b2.N_bytes; i++)
assert(b2.msg[i] == b1.msg[i]);
}
b1.reset();
b2.reset();
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t));
void test2()
{
srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu2[0], PDU2_LEN);
b1.N_bytes = PDU2_LEN;
@ -90,12 +93,14 @@ int main(int argc, char **argv) {
assert(0 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU2_LEN);
for(uint32_t i=0;i<b2.N_bytes;i++)
for (uint32_t i = 0; i < b2.N_bytes; i++)
assert(b2.msg[i] == b1.msg[i]);
}
b1.reset();
b2.reset();
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t));
void test3()
{
srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu3[0], PDU3_LEN);
b1.N_bytes = PDU3_LEN;
@ -113,12 +118,14 @@ int main(int argc, char **argv) {
assert(0 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU3_LEN);
for(uint32_t i=0;i<b2.N_bytes;i++)
for (uint32_t i = 0; i < b2.N_bytes; i++)
assert(b2.msg[i] == b1.msg[i]);
}
b1.reset();
b2.reset();
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t));
void test4()
{
srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu4[0], PDU4_LEN);
b1.N_bytes = PDU4_LEN;
@ -135,6 +142,13 @@ int main(int argc, char **argv) {
assert(2 == h.sn);
rlc_am_write_data_pdu_header(&h, &b2);
assert(b2.N_bytes == PDU4_LEN);
for(uint32_t i=0;i<b2.N_bytes;i++)
for (uint32_t i = 0; i < b2.N_bytes; i++)
assert(b2.msg[i] == b1.msg[i]);
}
int main(int argc, char **argv) {
test1();
test2();
test3();
test4();
}

Loading…
Cancel
Save