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,7 +51,8 @@ uint32_t PDU4_LEN = 5;
using namespace srslte; using namespace srslte;
int main(int argc, char **argv) { void test1()
{
srslte::rlc_amd_pdu_header_t h; srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2; srslte::byte_buffer_t b1, b2;
@ -70,10 +71,12 @@ int main(int argc, char **argv) {
assert(b2.N_bytes == PDU1_LEN); 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]); assert(b2.msg[i] == b1.msg[i]);
}
b1.reset(); void test2()
b2.reset(); {
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t)); srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu2[0], PDU2_LEN); memcpy(b1.msg, &pdu2[0], PDU2_LEN);
b1.N_bytes = PDU2_LEN; b1.N_bytes = PDU2_LEN;
@ -92,10 +95,12 @@ int main(int argc, char **argv) {
assert(b2.N_bytes == PDU2_LEN); 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]); assert(b2.msg[i] == b1.msg[i]);
}
b1.reset(); void test3()
b2.reset(); {
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t)); srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu3[0], PDU3_LEN); memcpy(b1.msg, &pdu3[0], PDU3_LEN);
b1.N_bytes = PDU3_LEN; b1.N_bytes = PDU3_LEN;
@ -115,10 +120,12 @@ int main(int argc, char **argv) {
assert(b2.N_bytes == PDU3_LEN); 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]); assert(b2.msg[i] == b1.msg[i]);
}
b1.reset(); void test4()
b2.reset(); {
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t)); srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1, b2;
memcpy(b1.msg, &pdu4[0], PDU4_LEN); memcpy(b1.msg, &pdu4[0], PDU4_LEN);
b1.N_bytes = PDU4_LEN; b1.N_bytes = PDU4_LEN;
@ -138,3 +145,10 @@ int main(int argc, char **argv) {
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]); assert(b2.msg[i] == b1.msg[i]);
} }
int main(int argc, char **argv) {
test1();
test2();
test3();
test4();
}

Loading…
Cancel
Save