aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-10-14 14:59:30 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-10-14 15:30:03 +0200
commit03223fe78612b9551f34f9740d8ba52b951e6226 (patch)
treed46e674299c1f968cbe8eeab5229d46c3a759d0e /src
parent3b18d21ba5d276f8fa4d22a91faaa71e62dc3c28 (diff)
tests,sms: print PDUs only on verbose test mode
Therefore, avoid needing TEST_SMS_PART_ENABLE_TRACE build symbol.
Diffstat (limited to 'src')
-rw-r--r--src/tests/test-sms-part-3gpp.c35
-rw-r--r--src/tests/test-sms-part-cdma.c35
2 files changed, 34 insertions, 36 deletions
diff --git a/src/tests/test-sms-part-3gpp.c b/src/tests/test-sms-part-3gpp.c
index 387cf151..9c67e6b9 100644
--- a/src/tests/test-sms-part-3gpp.c
+++ b/src/tests/test-sms-part-3gpp.c
@@ -26,23 +26,6 @@
#include "mm-sms-part-3gpp.h"
#include "mm-log.h"
-/* If defined will print debugging traces */
-#ifdef TEST_SMS_PART_ENABLE_TRACE
-#define trace_pdu(pdu, pdu_len) do { \
- guint i; \
- \
- g_print ("\n "); \
- for (i = 0; i < len; i++) { \
- g_print (" 0x%02X", pdu[i]); \
- if (((i + 1) % 12) == 0) \
- g_print ("\n "); \
- } \
- g_print ("\n"); \
- } while (0)
-#else
-#define trace_pdu(...)
-#endif
-
/********************* PDU PARSER TESTS *********************/
static void
@@ -509,6 +492,21 @@ test_address_encode_unknown (void)
/********************* PDU CREATOR TESTS *********************/
static void
+trace_pdu (const guint8 *pdu,
+ guint len)
+{
+ guint i;
+
+ g_print ("n ");
+ for (i = 0; i < len; i++) {
+ g_print (" 0x%02X", pdu[i]);
+ if (((i + 1) % 12) == 0)
+ g_print ("n ");
+ }
+ g_print ("n");
+}
+
+static void
common_test_create_pdu (const gchar *smsc,
const gchar *number,
const gchar *text,
@@ -549,7 +547,8 @@ common_test_create_pdu (const gchar *smsc,
&error);
mm_sms_part_free (part);
- trace_pdu (pdu, len);
+ if (g_test_verbose ())
+ trace_pdu (pdu, len);
g_assert_no_error (error);
g_assert (pdu != NULL);
diff --git a/src/tests/test-sms-part-cdma.c b/src/tests/test-sms-part-cdma.c
index 91b7c3ce..11988ed1 100644
--- a/src/tests/test-sms-part-cdma.c
+++ b/src/tests/test-sms-part-cdma.c
@@ -25,23 +25,6 @@
#include "mm-sms-part-cdma.h"
#include "mm-log.h"
-/* If defined will print debugging traces */
-#ifdef TEST_SMS_PART_ENABLE_TRACE
-#define trace_pdu(pdu, pdu_len) do { \
- guint i; \
- \
- g_print ("\n "); \
- for (i = 0; i < len; i++) { \
- g_print (" 0x%02X", pdu[i]); \
- if (((i + 1) % 12) == 0) \
- g_print ("\n "); \
- } \
- g_print ("\n"); \
- } while (0)
-#else
-#define trace_pdu(...)
-#endif
-
/********************* PDU PARSER TESTS *********************/
static void
@@ -370,6 +353,21 @@ test_unicode_encoding (void)
/********************* PDU CREATOR TESTS *********************/
static void
+trace_pdu (const guint8 *pdu,
+ guint len)
+{
+ guint i;
+
+ g_print ("n ");
+ for (i = 0; i < len; i++) {
+ g_print (" 0x%02X", pdu[i]);
+ if (((i + 1) % 12) == 0)
+ g_print ("n ");
+ }
+ g_print ("n");
+}
+
+static void
common_test_create_pdu (MMSmsCdmaTeleserviceId teleservice_id,
const gchar *number,
const gchar *text,
@@ -401,7 +399,8 @@ common_test_create_pdu (MMSmsCdmaTeleserviceId teleservice_id,
pdu = mm_sms_part_cdma_get_submit_pdu (part, &len, &error);
mm_sms_part_free (part);
- trace_pdu (pdu, len);
+ if (g_test_verbose ())
+ trace_pdu (pdu, len);
g_assert_no_error (error);
g_assert (pdu != NULL);