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

coding test: use OSMO_ASSERT

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


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/5078/1

diff --git a/tests/coding/coding_test.c b/tests/coding/coding_test.c
index 17a95f4..c3c2da0 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");
 }
@@ -196,7 +189,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");
 }
@@ -232,8 +225,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");
 }
@@ -269,8 +262,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");
 }
@@ -313,8 +306,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: newchange
Gerrit-Change-Id: I896d6aaae3c36b87243b7dc270267090dcb44afe
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <[email protected]>

Reply via email to