[PATCH] libosmocore[master]: Cleanup coding test

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Nov 28 14:00:27 UTC 2017


Review at  https://gerrit.osmocom.org/5063

Cleanup coding test

Remove duplicate code - use function from libosmocore (and link to it).

Change-Id: I8c31b0954176a2c53305936a025c92a793b6d9b6
---
M tests/Makefile.am
M tests/coding/coding_test.c
2 files changed, 7 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/5063/1

diff --git a/tests/Makefile.am b/tests/Makefile.am
index e11092d..c609d6a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -165,7 +165,7 @@
 socket_socket_test_SOURCES = socket/socket_test.c
 
 coding_coding_test_SOURCES = coding/coding_test.c
-coding_coding_test_LDADD = \
+coding_coding_test_LDADD = $(LDADD) \
   $(top_builddir)/src/gsm/libosmogsm.la \
   $(top_builddir)/src/codec/libosmocodec.la \
   $(top_builddir)/src/coding/libosmocoding.la
diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c
index 9a00f0d..32b8953 100644
--- a/tests/coding/coding_test.c
+++ b/tests/coding/coding_test.c
@@ -40,27 +40,6 @@
 /* set condition to 1, to show debugging */
 #define printd if (0) printf
 
-static int ubits2sbits(ubit_t *ubits, sbit_t *sbits, int count)
-{
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (*ubits == 0x23) {
-			ubits++;
-			sbits++;
-			continue;
-		}
-
-		if ((*ubits++) & 1) {
-			*sbits++ = -127;
-		} else {
-			*sbits++ = 127;
-		}
-	}
-
-	return count;
-}
-
 static void test_xcch(uint8_t *l2)
 {
 	uint8_t result[23];
@@ -73,7 +52,7 @@
 	gsm0503_xcch_encode(bursts_u, l2);
 
 	/* Prepare soft-bits */
-	ubits2sbits(bursts_u, bursts_s, 116 * 4);
+	osmo_ubit2sbit(bursts_s, bursts_u, 116 * 4);
 
 	printd("U-Bits:\n");
 	printd("%s %02x  %02x  ", osmo_hexdump(bursts_u, 57),
@@ -130,7 +109,7 @@
 	gsm0503_rach_encode(bursts_u, &ra, bsic);
 
 	/* Prepare soft-bits */
-	ubits2sbits(bursts_u, bursts_s, 36);
+	osmo_ubit2sbit(bursts_s, bursts_u, 36);
 
 	printd("U-Bits:\n");
 	printd("%s\n", osmo_hexdump(bursts_u, 36));
@@ -165,7 +144,7 @@
 	gsm0503_sch_encode(bursts_u, info);
 
 	/* Prepare soft-bits */
-	ubits2sbits(bursts_u, bursts_s, 78);
+	osmo_ubit2sbit(bursts_s, bursts_u, 78);
 
 	printd("U-Bits:\n");
 	printd("%s\n", osmo_hexdump(bursts_u, 78));
@@ -201,7 +180,7 @@
 	gsm0503_tch_fr_encode(bursts_u, speech, len, 1);
 
 	/* Prepare soft-bits */
-	ubits2sbits(bursts_u, bursts_s, 116 * 8);
+	osmo_ubit2sbit(bursts_s, bursts_u, 116 * 8);
 
 	printd("U-Bits:\n");
 	printd("%s %02x  %02x  ", osmo_hexdump(bursts_u, 57),
@@ -287,7 +266,7 @@
 	gsm0503_tch_hr_encode(bursts_u, speech, len);
 
 	/* Prepare soft-bits */
-	ubits2sbits(bursts_u, bursts_s, 116 * 6);
+	osmo_ubit2sbit(bursts_s, bursts_u, 116 * 6);
 
 	printd("U-Bits:\n");
 	printd("%s %02x  %02x  ", osmo_hexdump(bursts_u, 57),
@@ -371,7 +350,7 @@
 	gsm0503_pdtch_encode(bursts_u, l2, len);
 
 	/* Prepare soft-bits */
-	ubits2sbits(bursts_u, bursts_s, 116 * 4);
+	osmo_ubit2sbit(bursts_s, bursts_u, 116 * 4);
 
 	printd("U-Bits:\n");
 	printd("%s %02x  %02x  ", osmo_hexdump(bursts_u, 57),

-- 
To view, visit https://gerrit.osmocom.org/5063
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c31b0954176a2c53305936a025c92a793b6d9b6
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list