From 3b9ad84bdaddff5e54251d0fa0db631aedd74f60 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 7 Feb 2022 16:38:35 +0000 Subject: [PATCH] lib,rlc_am_nr: fix checking some statistics in unit test --- lib/test/rlc/rlc_am_nr_test.cc | 75 ++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/lib/test/rlc/rlc_am_nr_test.cc b/lib/test/rlc/rlc_am_nr_test.cc index b91d0e38a..f500a28a8 100644 --- a/lib/test/rlc/rlc_am_nr_test.cc +++ b/lib/test/rlc/rlc_am_nr_test.cc @@ -750,43 +750,46 @@ int retx_segment_test() } TESTASSERT(0 == rlc1.get_buffer_state()); } + + // Check statistics + rlc_bearer_metrics_t metrics1 = rlc1.get_metrics(); + rlc_bearer_metrics_t metrics2 = rlc2.get_metrics(); + + // SDU metrics + TESTASSERT_EQ(5, metrics1.num_tx_sdus); + TESTASSERT_EQ(0, metrics1.num_rx_sdus); + TESTASSERT_EQ(15, metrics1.num_tx_sdu_bytes); + TESTASSERT_EQ(0, metrics1.num_rx_sdu_bytes); + TESTASSERT_EQ(0, metrics1.num_lost_sdus); + + // PDU metrics + TESTASSERT_EQ(15 + 3, metrics1.num_tx_pdus); // 15 PDUs + 3 re-transmissions + TESTASSERT_EQ(2, metrics1.num_rx_pdus); // Two status PDU + TESTASSERT_EQ(78, metrics1.num_tx_pdu_bytes); // 3 Bytes * 5 (5 PDUs without SO) + 10 * 5 (10 PDUs with SO) + // 3 (1 retx no SO) + 2 * 5 (2 retx with SO) = 78 + TESTASSERT_EQ(24, metrics1.num_rx_pdu_bytes); // Two status PDU. One with just an ack (3 bytes) + // Another with 3 NACKs all with SO. (3 + 3*6 bytes) + TESTASSERT_EQ(0, metrics1.num_lost_sdus); // No lost SDUs + + // PDU metrics + TESTASSERT_EQ(0, metrics2.num_tx_sdus); + TESTASSERT_EQ(5, metrics2.num_rx_sdus); /* - // Check statistics - rlc_bearer_metrics_t metrics1 = rlc1.get_metrics(); - rlc_bearer_metrics_t metrics2 = rlc2.get_metrics(); - - // SDU metrics - TESTASSERT_EQ(5, metrics1.num_tx_sdus); - TESTASSERT_EQ(0, metrics1.num_rx_sdus); - TESTASSERT_EQ(15, metrics1.num_tx_sdu_bytes); - TESTASSERT_EQ(0, metrics1.num_rx_sdu_bytes); - TESTASSERT_EQ(0, metrics1.num_lost_sdus); - // PDU metrics - TESTASSERT_EQ(5 + 3, metrics1.num_tx_pdus); // 3 re-transmissions - TESTASSERT_EQ(2, metrics1.num_rx_pdus); // Two status PDU - TESTASSERT_EQ(38, metrics1.num_tx_pdu_bytes); // 2 Bytes * NBUFFS (header size) + NBUFFS * 3 (data) + - // 3 (1 retx no SO) + 2 * 5 (2 retx with SO) = 38 - TESTASSERT_EQ(3 + 5, metrics1.num_rx_pdu_bytes); // Two status PDU (one with a NACK) - TESTASSERT_EQ(0, metrics1.num_lost_sdus); // No lost SDUs - - // PDU metrics - TESTASSERT_EQ(0, metrics2.num_tx_sdus); - TESTASSERT_EQ(5, metrics2.num_rx_sdus); - TESTASSERT_EQ(0, metrics2.num_tx_sdu_bytes); - TESTASSERT_EQ(15, metrics2.num_rx_sdu_bytes); // 5 SDUs, 3 bytes each - TESTASSERT_EQ(0, metrics2.num_lost_sdus); - // SDU metrics - TESTASSERT_EQ(2, metrics2.num_tx_pdus); // Two status PDUs - TESTASSERT_EQ(7, metrics2.num_rx_pdus); // 7 PDUs (8 tx'ed, but one was lost) - TESTASSERT_EQ(5 + 3, metrics2.num_tx_pdu_bytes); // Two status PDU (one with a NACK) - TESTASSERT_EQ(33, metrics2.num_rx_pdu_bytes); // 2 Bytes * (NBUFFS-1) (header size) + (NBUFFS-1) * 3 (data) - // 3 (1 retx no SO) + 2 * 5 (2 retx with SO) = 33 - TESTASSERT_EQ(0, metrics2.num_lost_sdus); // No lost SDUs - - // Check state - rlc_am_nr_rx_state_t state2_rx = rx2->get_rx_state(); - TESTASSERT_EQ(5, state2_rx.rx_next); - */ + TESTASSERT_EQ(0, metrics2.num_tx_sdu_bytes); + TESTASSERT_EQ(15, metrics2.num_rx_sdu_bytes); // 5 SDUs, 3 bytes each + TESTASSERT_EQ(0, metrics2.num_lost_sdus); + // SDU metrics + TESTASSERT_EQ(2, metrics2.num_tx_pdus); // Two status PDUs + TESTASSERT_EQ(7, metrics2.num_rx_pdus); // 7 PDUs (8 tx'ed, but one was lost) + TESTASSERT_EQ(5 + 3, metrics2.num_tx_pdu_bytes); // Two status PDU (one with a NACK) + TESTASSERT_EQ(33, metrics2.num_rx_pdu_bytes); // 2 Bytes * (NBUFFS-1) (header size) + (NBUFFS-1) * 3 (data) + // 3 (1 retx no SO) + 2 * 5 (2 retx with SO) = 33 + TESTASSERT_EQ(0, metrics2.num_lost_sdus); // No lost SDUs + + // Check state + rlc_am_nr_rx_state_t state2_rx = rx2->get_rx_state(); + TESTASSERT_EQ(5, state2_rx.rx_next); + */ return SRSRAN_SUCCESS; }