From d19bf69170b373d936ebbc2e35fd2adfb53ff42a Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Tue, 17 May 2011 12:02:52 +0200 Subject: cesar/{mac/common,ce/rx/bl}: add stats on PB/frame handled by TM, refs #2375 --- cesar/ce/rx/bitloading/test/src/test_fsm.c | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'cesar/ce/rx/bitloading/test') diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c index c9e90fdacd..03fa9c278c 100644 --- a/cesar/ce/rx/bitloading/test/src/test_fsm.c +++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c @@ -74,6 +74,7 @@ test_ce_rx_bl_fsm_base (test_t t) sta_t sta; tonemaps_t rx_tms, tx_tms; uint i; + uint stats_pb = 0, stats_frame = 0; for (i = 0; i < TONEMAP_INDEX_NB; i++) { rx_tms.tm[i] = NULL; @@ -86,6 +87,8 @@ test_ce_rx_bl_fsm_base (test_t t) rx_tms.default_tmi = tmi_av; tm.bits_per_symbol = 1; tm.ber_target_reached = 1; + /* Reset statistics. */ + tm.nb_pb = tm.nb_frame = 0; ce_rx_bitloading_init (&sta.ce_rx_bt); for (i = 0; i < COUNT (sta.ce_rx_bt.next_date_min_for_restart_rtc_date); i++) sta.ce_rx_bt.next_date_min_for_restart_rtc_date[i] = 0; @@ -107,6 +110,9 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_END, }; scenario_run (t, fsm_base, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); } test_end; test_case_begin (t, "many sounds, one sound complete, bit loading " @@ -157,6 +163,9 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_END, }; scenario_run (t, fsm_base, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); } test_end; test_case_begin (t, "one sound complete, bit loading initial"); @@ -182,6 +191,9 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_END, }; scenario_run (t, fsm_base, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); } test_end; test_case_begin (t, "many sound complete, one bit loading"); @@ -204,6 +216,9 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_END, }; scenario_run (t, fsm_base, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -232,6 +247,9 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_END, }; scenario_run (t, fsm_base, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -258,6 +276,8 @@ test_ce_rx_bl_fsm_base (test_t t) { measure.total_pb_count = 1 + lib_rnd_uniform (&rnd, ((u8) -1)); + stats_pb += measure.total_pb_count; + stats_frame++; measure.false_pb_count = lib_rnd_uniform (&rnd, measure.total_pb_count / ce_rx_bl_pb_total_factor_); @@ -272,6 +292,9 @@ test_ce_rx_bl_fsm_base (test_t t) } scenario_test[pos++] = scenario_end; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -290,6 +313,8 @@ test_ce_rx_bl_fsm_base (test_t t) + lib_rnd_uniform (&rnd, ((u8) (-1) - ce_rx_bl_min_pb_per_frame_)); dbg_assert (measure.total_pb_count); + stats_pb += measure.total_pb_count; + stats_frame++; if (i % (ce_rx_bl_min_frame_with_high_pb_err_rate_ - 1) == 0) measure.false_pb_count = 0; else @@ -306,6 +331,9 @@ test_ce_rx_bl_fsm_base (test_t t) } scenario_test[pos++] = scenario_end; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -321,6 +349,8 @@ test_ce_rx_bl_fsm_base (test_t t) { measure.total_pb_count = 1; measure.false_pb_count = lib_rnd_uniform (&rnd, (u8) -1); + stats_pb += measure.total_pb_count; + stats_frame++; scenario_test[pos++] = (scenario_entry_t) SCENARIO_ACTION (TRACKING__data, .sta = &sta, @@ -333,6 +363,9 @@ test_ce_rx_bl_fsm_base (test_t t) } scenario_test[pos++] = scenario_end; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -361,6 +394,9 @@ test_ce_rx_bl_fsm_base (test_t t) } scenario_test[pos++] = scenario_end; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -405,8 +441,13 @@ test_ce_rx_bl_fsm_base (test_t t) }; for (i = 0; i < COUNT (sub_sc_ce_restart); i++) scenario_test[i + pos] = sub_sc_ce_restart[i]; + stats_pb += measure.total_pb_count * (limit + 1); + stats_frame += limit + 1; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -435,8 +476,13 @@ test_ce_rx_bl_fsm_base (test_t t) scenario_test[pos++] = (scenario_entry_t) SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update); } + stats_pb += measure.total_pb_count * limit; + stats_frame += limit; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); sta.ce_rx_bt.next_date_min_for_restart_rtc_date[0] = 0; @@ -471,8 +517,13 @@ test_ce_rx_bl_fsm_base (test_t t) .tms = sta.tx_tonemaps); scenario_test[pos++] = (scenario_entry_t) SCENARIO_END; + stats_pb += measure.total_pb_count; + stats_frame++; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -500,8 +551,13 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update); scenario_test[pos++] = (scenario_entry_t) SCENARIO_END; + stats_pb += measure.total_pb_count; + stats_frame++; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); sta.ce_rx_bt.next_date_min_for_restart_rtc_date[1] = 0; @@ -539,6 +595,9 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_END; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); rx_tms.default_tmi = tmi_av; @@ -566,8 +625,13 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update); scenario_test[pos++] = (scenario_entry_t) SCENARIO_END; + stats_pb += measure.total_pb_count; + stats_frame++; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; @@ -596,8 +660,13 @@ test_ce_rx_bl_fsm_base (test_t t) SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update); scenario_test[pos++] = (scenario_entry_t) SCENARIO_END; + stats_pb += measure.total_pb_count; + stats_frame++; scenario_run (t, scenario_test, &globals); + /* Check statistics. */ + test_fail_if (tm.nb_pb != stats_pb); + test_fail_if (tm.nb_frame != stats_frame); /* Clean. */ ce_rx_bitloading_uninit (&sta.ce_rx_bt); } test_end; -- cgit v1.2.3