[MERGED] libosmocore[master]: coding test: use OSMO_ASSERT

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Dec 1 11:54:01 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: coding test: use OSMO_ASSERT
......................................................................


coding test: use OSMO_ASSERT

Change-Id: I896d6aaae3c36b87243b7dc270267090dcb44afe
---
M tests/coding/coding_test.c
1 file changed, 10 insertions(+), 17 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c
index 9a8cdb3..b77410f 100644
--- a/tests/coding/coding_test.c
+++ b/tests/coding/coding_test.c
@@ -30,13 +30,6 @@
 
 #include <osmocom/coding/gsm0503_coding.h>
 
-#define ASSERT_TRUE(rc) \
-	if (!(rc)) { \
-		printf("Assert failed in %s:%d.\n",  \
-		       __FILE__, __LINE__);          \
-		abort();			     \
-	}
-
 #define DUMP_U_AT(b, x, u) do {						\
 		printf("%s %02x  %02x  ", osmo_ubit_dump(b + x, 57), b[57 + x], b[58 + x]); \
 		printf("%s\n",            osmo_ubit_dump(b + 59 + x, 57)); \
@@ -103,8 +96,8 @@
 	printf("xcch_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
 		n_errors, n_bits_total, (float) n_errors / n_bits_total);
 
-	ASSERT_TRUE(n_bits_total == 456);
-	ASSERT_TRUE(!memcmp(l2, result, 23));
+	OSMO_ASSERT(n_bits_total == 456);
+	OSMO_ASSERT(!memcmp(l2, result, 23));
 
 	printf("\n");
 }
@@ -133,7 +126,7 @@
 	gsm0503_rach_decode(&result, bursts_s, bsic);
 	printf("Decoded: %02x\n", result);
 
-	ASSERT_TRUE(ra == result);
+	OSMO_ASSERT(ra == result);
 
 	printf("\n");
 }
@@ -166,7 +159,7 @@
 	gsm0503_sch_decode(result, bursts_s);
 	printf("Decoded: %s\n", osmo_hexdump(result, 4));
 
-	ASSERT_TRUE(!memcmp(info, result, 4));
+	OSMO_ASSERT(!memcmp(info, result, 4));
 
 	printf("\n");
 }
@@ -202,8 +195,8 @@
 	printf("tch_fr_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
 		n_errors, n_bits_total, (float)n_errors/n_bits_total);
 
-	ASSERT_TRUE(rc == len);
-	ASSERT_TRUE(!memcmp(speech, result, len));
+	OSMO_ASSERT(rc == len);
+	OSMO_ASSERT(!memcmp(speech, result, len));
 
 	printf("\n");
 }
@@ -239,8 +232,8 @@
 	printf("tch_hr_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
 		n_errors, n_bits_total, (float)n_errors/n_bits_total);
 
-	ASSERT_TRUE(rc == len);
-	ASSERT_TRUE(!memcmp(speech, result, len));
+	OSMO_ASSERT(rc == len);
+	OSMO_ASSERT(!memcmp(speech, result, len));
 
 	printf("\n");
 }
@@ -283,8 +276,8 @@
 	printf("pdtch_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
 		n_errors, n_bits_total, (float)n_errors/n_bits_total);
 
-	ASSERT_TRUE(rc == len);
-	ASSERT_TRUE(!memcmp(l2, result, len));
+	OSMO_ASSERT(rc == len);
+	OSMO_ASSERT(!memcmp(l2, result, len));
 
 	printf("\n");
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I896d6aaae3c36b87243b7dc270267090dcb44afe
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>



More information about the gerrit-log mailing list