summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/test
diff options
context:
space:
mode:
authorJalil Chemseddine2012-06-12 18:24:09 +0200
committerJalil Chemseddine2012-06-28 17:14:59 +0200
commit6bac468a38feb41ee3e94f844f5513b8265931fc (patch)
tree719904cc79cb608af3520860d01261394b2195d1 /cesar/ce/rx/bitloading/test
parent90da057b3e1535dad7a3a0b3183f5b3e25e9f27e (diff)
cesar/ce/rx/bl: evaluate BER polynomials on all NSR ranges, refs #3101
Diffstat (limited to 'cesar/ce/rx/bitloading/test')
-rw-r--r--cesar/ce/rx/bitloading/test/host-Makefile5
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_bl.c36
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_poly.c109
3 files changed, 113 insertions, 37 deletions
diff --git a/cesar/ce/rx/bitloading/test/host-Makefile b/cesar/ce/rx/bitloading/test/host-Makefile
index a065f5e794..08d004fe60 100644
--- a/cesar/ce/rx/bitloading/test/host-Makefile
+++ b/cesar/ce/rx/bitloading/test/host-Makefile
@@ -7,7 +7,7 @@ VARIANT = host
include common-define.mk
# List of program to build.
-HOST_PROGRAMS = test_ce_host test_ce_intervals
+HOST_PROGRAMS = test_ce_host test_ce_intervals test_ce_poly
test_ce_host_SOURCES = $(ce_rx_bl_test_sources_common) ecos_stub.c
test_ce_host_MODULES = $(ce_rx_bl_modules_common) ce/rx
@@ -19,6 +19,9 @@ test_ce_intervals_SOURCES = test_intervals.c ecos_stub.c
test_ce_intervals_MODULES = $(ce_rx_bl_modules_common)
test_ce_intervals_CONFIG_MODULES = cp
+test_ce_poly_SOURCES = test_poly.c ecos_stub.c
+test_ce_poly_MODULES = $(ce_rx_bl_modules_common)
+
INCLUDES += ce/rx/bitloading/test/override
# Include base makefile.
diff --git a/cesar/ce/rx/bitloading/test/src/test_bl.c b/cesar/ce/rx/bitloading/test/src/test_bl.c
index 2c28b6ec2f..9de9c6f525 100644
--- a/cesar/ce/rx/bitloading/test/src/test_bl.c
+++ b/cesar/ce/rx/bitloading/test/src/test_bl.c
@@ -441,42 +441,6 @@ test_suite_ce_rx_bl_ber (test_t t)
}
} test_end;
- test_begin (t, "theoretical BER respect range")
- {
- uint i, j;
- s64 ber, ber_prev;
- phy_fecrate_t rate;
-
- /* For each FEC rate. */
- for (rate = PHY_FEC_RATE_1_2; rate < PHY_FEC_RATE_NB; rate++)
- {
- /* Go through each entry of the vector. */
- for (i = 0; i < mean_on_sound_nsr_height;
- i++)
- {
- /* When there is some NSR. */
- if (mean_on_sound_nsr[i][0])
- {
- for (j = 0; j < CE_MOD_COUNT; j++)
- {
- /* Get theoretical BER. */
- ber = ce_rx_bl_ber_for_mod
- (ce_rx_bl_ber_poly_coef[rate],
- mean_on_sound_nsr[i][0], j);
- /* Check its respect range. */
- test_fail_if (ber < CE_RX_BL_BER_DEFAULT_UNDER
- || ber > CE_RX_BL_BER_DEFAULT_OVER);
- /* Check that previous BER is always lower than new
- * BER. */
- if (j)
- test_fail_if (ber_prev > ber);
- ber_prev = ber;
- }
- }
- }
- }
- } test_end;
-
test_begin (t, "modulation under BER consign (no iteration)")
{
uint i;
diff --git a/cesar/ce/rx/bitloading/test/src/test_poly.c b/cesar/ce/rx/bitloading/test/src/test_poly.c
new file mode 100644
index 0000000000..acfdc1fa69
--- /dev/null
+++ b/cesar/ce/rx/bitloading/test/src/test_poly.c
@@ -0,0 +1,109 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file ce/rx/bitloading/test/src/test_poly.c
+ * \brief Test CE RX polynomials.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+
+#include "ce/rx/bitloading/inc/ber.h"
+
+void
+test_ce_rx_poly (test_t t)
+{
+ u64 ber, ber_prev = 0;
+ u32 nsr;
+ u8 mod_index;
+ phy_fecrate_t fec_rate;
+ ce_rx_bl_ber_poly_coef_t *poly;
+
+ test_begin (t, "output BER values should increase when NSR increase")
+ {
+ for (mod_index = 1; mod_index < CE_MOD_COUNT; mod_index++)
+ {
+ for (fec_rate = 0; fec_rate < PHY_FEC_RATE_NB; fec_rate++)
+ {
+ poly = &ce_rx_bl_ber_poly_coef[fec_rate][mod_index - 1];
+ ber_prev = 0;
+
+ for (nsr = poly->range[0];
+ nsr <= poly->range[poly->poly_count];
+ nsr++)
+ {
+ ber = ce_rx_bl_ber_for_mod
+ (ce_rx_bl_ber_poly_coef[fec_rate], nsr, mod_index);
+ test_fail_if (ber_prev > ber,
+ "previous BER is over current one ("
+ "fec_rate = %d, mod_index = %d, nsr = %d, "
+ "ber_prev = %lld, ber_value = %lld)",
+ fec_rate, mod_index, nsr, ber_prev, ber);
+ test_fail_if (ber >= CE_RX_BL_BER_DEFAULT_OVER,
+ "BER at max (fec_rate = %d, "
+ "mod_index = %d, nsr = %d)",
+ fec_rate, mod_index, nsr);
+ test_fail_if (ber <= CE_RX_BL_BER_DEFAULT_UNDER,
+ "BER at min (fec_rate = %d, "
+ "mod_index = %d, nsr = %d)",
+ fec_rate, mod_index, nsr);
+ ber_prev = ber;
+ }
+ }
+ }
+ } test_end;
+
+ test_begin (t, "output BER values should increase when modulation "
+ "increase (with fixed NSR)")
+ {
+ for (fec_rate = 0; fec_rate < PHY_FEC_RATE_NB; fec_rate++)
+ {
+ /* Get NSR range min, max. */
+ uint nsr_min = (uint) -1, nsr_max = 0;
+ for (mod_index = 1; mod_index < CE_MOD_COUNT; mod_index++)
+ {
+ poly = &ce_rx_bl_ber_poly_coef[fec_rate][mod_index - 1];
+ nsr_min = MIN (nsr_min, poly->range[0]);
+ nsr_max = MAX (nsr_max, poly->range[poly->poly_count]);
+ }
+ /* Go through all supported NSR. */
+ for (nsr = nsr_min; nsr < nsr_max; nsr++)
+ {
+ ber_prev = 0;
+ for (mod_index = 1; mod_index < CE_MOD_COUNT; mod_index++)
+ {
+ ber = ce_rx_bl_ber_for_mod
+ (ce_rx_bl_ber_poly_coef[fec_rate], nsr, mod_index);
+ test_fail_if (ber_prev > ber,
+ "previous BER is over current one ("
+ "fec_rate = %d, mod_index = %d, nsr = %d, "
+ "ber_prev = %lld, ber_value = %lld)",
+ fec_rate, mod_index, nsr, ber_prev, ber);
+ test_fail_if (ber > CE_RX_BL_BER_DEFAULT_OVER);
+ ber_prev = ber;
+ }
+ }
+ }
+ } test_end;
+}
+
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+
+ test_suite_begin (t, "CE:RX:POLY");
+
+ test_ce_rx_poly (t);
+
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}