summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/test/src
diff options
context:
space:
mode:
authorJalil Chemseddine2012-11-19 13:45:19 +0100
committerJalil Chemseddine2012-12-12 17:42:15 +0100
commit5d484d2df3f484f861a24d591c49201405a9884d (patch)
tree94a108b22bbd99f14a89fbeee2eabbb91e9baf22 /cesar/ce/rx/bitloading/test/src
parent3795cd660576bca0156721caa8669ed23f9c339f (diff)
cesar/ce/rx/bl: update tests to handle new polynomials BER vs NSR, closes #2560
Diffstat (limited to 'cesar/ce/rx/bitloading/test/src')
-rw-r--r--cesar/ce/rx/bitloading/test/src/polynomial_vector.sci31
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_bl.c28
2 files changed, 39 insertions, 20 deletions
diff --git a/cesar/ce/rx/bitloading/test/src/polynomial_vector.sci b/cesar/ce/rx/bitloading/test/src/polynomial_vector.sci
index a877554fb5..ec529dfea0 100644
--- a/cesar/ce/rx/bitloading/test/src/polynomial_vector.sci
+++ b/cesar/ce/rx/bitloading/test/src/polynomial_vector.sci
@@ -6,8 +6,6 @@ raw_min = 0;
raw_max = 65535;
raw_step = 7;
// NSR polynomial.
-nsr_min = 5461;
-nsr_max = 131070;
nsr_step = 11;
// Load coefficients.
@@ -15,21 +13,34 @@ coef_fd = file ('open', 'data/polynomial_coef.data', 'unknown');
if coef_fd < 0
exit ();
end
-nsr_deg = read (coef_fd, 1, 1);
-nsr_coef = read (coef_fd, 1, nsr_deg + 1);
-
-file ('close', coef_fd);
// Build polynomials.
-nsr_poly = poly (nsr_coef, "i", ["coeff"]);
raw_poly = poly ([1, -2, 3, -15], "i", ["coeff"]);
// First polynomial
index = 1;
-for i = [nsr_min:nsr_step:nsr_max]
- nsr_result (index) = horner (nsr_poly, i);
- index = index + 1;
+mod_index = 1;
+nsr_nb_poly = read (coef_fd, 1, 1);
+nsr_deg = read (coef_fd, 1, 1);
+nsr_min = read (coef_fd, 1, 1);
+for j = 1:1:nsr_nb_poly
+
+ nsr_max = read (coef_fd, 1, 1);
+ nsr_max = nsr_max - nsr_step;
+ nsr_coef = read (coef_fd, 1, nsr_deg + 1);
+ // Build polynomials.
+ nsr_poly = poly (nsr_coef, "i", ["coeff"]);
+ for i = [nsr_min:nsr_step:nsr_max]
+ nsr_result (index) = horner (nsr_poly, i);
+ nsr_val(index) = i;
+ nsr_poly_index(index) = j;
+ index = index + 1;
+ end
+ nsr_min = nsr_max + nsr_step + 1;
end
+
+file ('close', coef_fd);
+
// Second polynomial
index = 1;
for i = [raw_min:raw_step:raw_max]
diff --git a/cesar/ce/rx/bitloading/test/src/test_bl.c b/cesar/ce/rx/bitloading/test/src/test_bl.c
index 6d3788f3ef..732813c29d 100644
--- a/cesar/ce/rx/bitloading/test/src/test_bl.c
+++ b/cesar/ce/rx/bitloading/test/src/test_bl.c
@@ -327,7 +327,7 @@ test_suite_ce_rx_bl_nsr_sum (test_t t)
TONEMAP_READ_END;
#undef TONEMAP_READ_OPEN
#undef TONEMAP_READ_CLOSE
- test_fail_if (tone_diff != 0, "%d computed tone(s) differs from test "
+ test_fail_if (tone_diff > TONE_TOLERATED_ERROR, "%d computed tone(s) differs from test "
"vector", tone_diff);
} test_end;
tonemap_free (tm);
@@ -423,18 +423,26 @@ test_suite_ce_rx_bl_ber (test_t t)
test_begin (t, "BER polynomial")
{
- uint i;
+ uint i,j;
const uint nsr_step = 11;
- const uint nsr_start = 5461;
+ const u32 *nsr_polychange = &ce_rx_bl_ber_poly_coef[0].range[0];
uint nsr;
- /* Go through each entry of the vector. */
- for (i = 1, nsr = nsr_start + nsr_step;
- i < polynomial_nsr_height; i++, nsr += nsr_step)
+ i = 1;
+ j = 0;
+ nsr = (*nsr_polychange++) + nsr_step;
+ while ( j < ce_rx_bl_ber_poly_coef[0].poly_count )
{
- /* Compute BER. */
- s64 ber = ce_rx_bl_ber_for_mod_initial (nsr, 1);
- /* Test failed if difference over tolerated error. */
- test_fail_if (ABS (ber - polynomial_nsr[i][0]) != 0);
+ /* Go through each entry of the vector. */
+ for (;
+ i < polynomial_nsr_height && nsr <= (nsr_polychange[j] - nsr_step);
+ i++, nsr += nsr_step)
+ {
+ /* Compute BER. */
+ s64 ber = ce_rx_bl_ber_for_mod_initial (nsr, 1);
+ /* Test failed if difference over tolerated error. */
+ test_fail_if (ABS (ber - polynomial_nsr[i][0]) != 0);
+ }
+ nsr = nsr_polychange[j++] + 1 ;
}
} test_end;