summaryrefslogtreecommitdiffstats
path: root/tests/codec/codec_ecu_fr_test.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-20 19:12:18 +0200
committerHarald Welte <laforge@gnumonks.org>2018-07-21 07:40:20 +0000
commit421068e643ba295c849ec86d6579d1853447b12d (patch)
tree4a4abbfbc0b1651acb04928ae95efb7b0c153057 /tests/codec/codec_ecu_fr_test.c
parentbbccca60d6d8cda63bf9fc1d0158be2c94c3fe8c (diff)
tests: codec: ecu_fr: Add buffer with unequal XMAXC values
This buffer verifies that all XMAXC fields must be zero before the entire buffer is considered as silent by osmo_ecu_fr_conceal(). Change-Id: I14a192d001b5e167437cedbe76a1a3dd84dde35c
Diffstat (limited to 'tests/codec/codec_ecu_fr_test.c')
-rw-r--r--tests/codec/codec_ecu_fr_test.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/tests/codec/codec_ecu_fr_test.c b/tests/codec/codec_ecu_fr_test.c
index 3a99fc72..3561c442 100644
--- a/tests/codec/codec_ecu_fr_test.c
+++ b/tests/codec/codec_ecu_fr_test.c
@@ -73,8 +73,11 @@ static const char *fr_frames_hex[] = {
};
/* Example of a good frame */
-static const char *sample_frame_hex = \
- "d9ec9be212901f802335598c501f805bad3d4ba01f809b69df5a501f809cd1b4da";
+static const char *sample_frame_hex[] = {
+ "d9ec9be212901f802335598c501f805bad3d4ba01f809b69df5a501f809cd1b4da",
+ "d9ec9be212901d802335598c5013805bad3d4ba01f809b69df5a5019809cd1b4da",
+ NULL
+};
#define GSM610_XMAXC_LEN 6
static void parse_xmaxc_frame(uint8_t *frame, uint64_t xmaxc_res[4])
@@ -108,26 +111,32 @@ void test_fr_concealment(void)
uint8_t frame[GSM_FR_BYTES];
uint64_t xmaxc[4];
int i, rc;
+ int j = 0;
- /* Parse frame from string to hex */
- osmo_hexparse(sample_frame_hex, frame, GSM_FR_BYTES);
- parse_xmaxc_frame(frame, xmaxc);
- printf("Start with: %s, XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
- sample_frame_hex, xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
+ while (sample_frame_hex[j] != NULL) {
+ /* Parse frame from string to hex */
+ osmo_hexparse(sample_frame_hex[j], frame, GSM_FR_BYTES);
+ parse_xmaxc_frame(frame, xmaxc);
+ printf("Start with: %s, XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
+ sample_frame_hex[j], xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
- /* Reset the ECU with the proposed known good frame */
- osmo_ecu_fr_reset(&state, frame);
+ /* Reset the ECU with the proposed known good frame */
+ osmo_ecu_fr_reset(&state, frame);
- /* Now pretend that we do not receive any good frames anymore */
- for (i = 0; i < 20; i++) {
+ /* Now pretend that we do not receive any good frames anymore */
+ for (i = 0; i < 20; i++) {
- rc = osmo_ecu_fr_conceal(&state, frame);
- OSMO_ASSERT(rc == 0);
- parse_xmaxc_frame(frame, xmaxc);
+ rc = osmo_ecu_fr_conceal(&state, frame);
+ OSMO_ASSERT(rc == 0);
+ parse_xmaxc_frame(frame, xmaxc);
+
+ printf("conceal: %02i, result: %s XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
+ i, osmo_hexdump_nospc(frame, GSM_FR_BYTES),
+ xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
+ }
- printf("conceal: %02i, result: %s XMAXC: [%"PRIx64", %"PRIx64", %"PRIx64", %"PRIx64"]\n",
- i, osmo_hexdump_nospc(frame, GSM_FR_BYTES),
- xmaxc[0], xmaxc[1], xmaxc[2], xmaxc[3]);
+ /* Go to the next frame */
+ j++;
}
}