summaryrefslogtreecommitdiffstats
path: root/tests/codec/codec_ecu_fr_test.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-09-19 10:34:11 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2019-09-20 11:21:46 +0200
commitae140bc84a3cc771d730a0ab8522707773eb8c0d (patch)
treecdeff6491d84bef0620207a0fc85e91cc37e9f42 /tests/codec/codec_ecu_fr_test.c
parent4e591b120fd7e412f473d124547df7d35000e102 (diff)
ecu_fr: increase test coverage for FR ECU implementation
The ECU implementation for FR is currently tested by calling the related functions directly and by using the generic ECU abstraction layer. However, the test "test_fr_concealment" only tests directly. Lets add a version that uses the generic ECU abstraction layer as well. The generic ECU abstraction layer obsolets the public API functions osmo_ecu_fr_reset() and osmo_ecu_fr_conceal(), lets tag those functions as dprecated. Change-Id: Ib0c8a9b164f14ea4fa00688f760a76cdb4890af4
Diffstat (limited to 'tests/codec/codec_ecu_fr_test.c')
-rw-r--r--tests/codec/codec_ecu_fr_test.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/codec/codec_ecu_fr_test.c b/tests/codec/codec_ecu_fr_test.c
index 7ebc558f..4040ce94 100644
--- a/tests/codec/codec_ecu_fr_test.c
+++ b/tests/codec/codec_ecu_fr_test.c
@@ -142,6 +142,46 @@ void test_fr_concealment(void)
}
}
+/* Same as test_fr_concealment() but using generic core */
+void test_fr_concealment_core(void)
+{
+ struct osmo_ecu_state *state = osmo_ecu_init(NULL, OSMO_ECU_CODEC_FR);
+ uint8_t frame[GSM_FR_BYTES];
+ uint64_t xmaxc[4];
+ int i, rc;
+ int j = 0;
+
+ printf("=> Testing FR concealment (simple, consecutive bad frames)\n");
+
+ 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_frame_in(state, false, frame, GSM_FR_BYTES);
+
+ /* Now pretend that we do not receive any good frames anymore */
+ for (i = 0; i < 20; i++) {
+
+ rc = osmo_ecu_frame_out(state, frame);
+ OSMO_ASSERT(rc == GSM_FR_BYTES);
+ 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]);
+ }
+
+ /* Go to the next frame */
+ j++;
+ }
+
+ osmo_ecu_destroy(state);
+}
+
/* Simulate a real life situation: voice frames with a few dropouts */
void test_fr_concealment_realistic()
{
@@ -224,6 +264,7 @@ int main(int argc, char **argv)
{
/* Perform actual tests */
test_fr_concealment();
+ test_fr_concealment_core();
test_fr_concealment_realistic();
test_fr_concealment_realistic_core();