From 421068e643ba295c849ec86d6579d1853447b12d Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 20 Jul 2018 19:12:18 +0200 Subject: 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 --- tests/codec/codec_ecu_fr_test.c | 43 ++++++++++++++++++++++++---------------- tests/codec/codec_ecu_fr_test.ok | 21 ++++++++++++++++++++ 2 files changed, 47 insertions(+), 17 deletions(-) (limited to 'tests') 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++; } } diff --git a/tests/codec/codec_ecu_fr_test.ok b/tests/codec/codec_ecu_fr_test.ok index 52d06a1b..3cc35af9 100644 --- a/tests/codec/codec_ecu_fr_test.ok +++ b/tests/codec/codec_ecu_fr_test.ok @@ -19,6 +19,27 @@ conceal: 16, result: d0000000000000000000000000000000000000000000000000000000000 conceal: 17, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] conceal: 18, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] conceal: 19, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] +Start with: d9ec9be212901d802335598c5013805bad3d4ba01f809b69df5a5019809cd1b4da, XMAXC: [3b, 27, 3f, 33] +conceal: 00, result: d9ec9be212901d802335598c5013805bad3d4ba01f809b69df5a5019809cd1b4da XMAXC: [3b, 27, 3f, 33] +conceal: 01, result: d9ec9be212901b802335598c5011805bad3d4ba01d809b69df5a5017809cd1b4da XMAXC: [37, 23, 3b, 2f] +conceal: 02, result: d9ec9be2129019802335598c500f805bad3d4ba01b809b69df5a5015809cd1b4da XMAXC: [33, 1f, 37, 2b] +conceal: 03, result: d9ec9be2129017802335598c500d805bad3d4ba019809b69df5a5013809cd1b4da XMAXC: [2f, 1b, 33, 27] +conceal: 04, result: d9ec9be2129015802335598c500b805bad3d4ba017809b69df5a5011809cd1b4da XMAXC: [2b, 17, 2f, 23] +conceal: 05, result: d9ec9be2129013802335598c5009805bad3d4ba015809b69df5a500f809cd1b4da XMAXC: [27, 13, 2b, 1f] +conceal: 06, result: d9ec9be2129011802335598c5007805bad3d4ba013809b69df5a500d809cd1b4da XMAXC: [23, f, 27, 1b] +conceal: 07, result: d9ec9be212900f802335598c5005805bad3d4ba011809b69df5a500b809cd1b4da XMAXC: [1f, b, 23, 17] +conceal: 08, result: d9ec9be212900d802335598c5003805bad3d4ba00f809b69df5a5009809cd1b4da XMAXC: [1b, 7, 1f, 13] +conceal: 09, result: d9ec9be212900b802335598c5001805bad3d4ba00d809b69df5a5007809cd1b4da XMAXC: [17, 3, 1b, f] +conceal: 10, result: d9ec9be2129009802335598c5000005bad3d4ba00b809b69df5a5005809cd1b4da XMAXC: [13, 0, 17, b] +conceal: 11, result: d9ec9be2129007802335598c5000005bad3d4ba009809b69df5a5003809cd1b4da XMAXC: [f, 0, 13, 7] +conceal: 12, result: d9ec9be2129005802335598c5000005bad3d4ba007809b69df5a5001809cd1b4da XMAXC: [b, 0, f, 3] +conceal: 13, result: d9ec9be2129003802335598c5000005bad3d4ba005809b69df5a5000009cd1b4da XMAXC: [7, 0, b, 0] +conceal: 14, result: d9ec9be2129001802335598c5000005bad3d4ba003809b69df5a5000009cd1b4da XMAXC: [3, 0, 7, 0] +conceal: 15, result: d9ec9be2129000002335598c5000005bad3d4ba001809b69df5a5000009cd1b4da XMAXC: [0, 0, 3, 0] +conceal: 16, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] +conceal: 17, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] +conceal: 18, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] +conceal: 19, result: d00000000000000000000000000000000000000000000000000000000000000000 XMAXC: [0, 0, 0, 0] Frame No. 000: * input: d9aa93ae63de00471a91b95b8660471392b4a2daa037628f391c624039258dc723 * output: d9aa93ae63de00471a91b95b8660471392b4a2daa037628f391c624039258dc723 -- cgit v1.2.3