[MERGED] libosmocore[master]: gsm0408_test: include BCD and leading zeros in test output

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
Thu Feb 22 07:49:09 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: gsm0408_test: include BCD and leading zeros in test output
......................................................................


gsm0408_test: include BCD and leading zeros in test output

(Preparation for adding 3-digit MNC)

Change-Id: I7f8ae05fa3e4a6fc004212757b05ca8a14c9ef45
---
M tests/gsm0408/gsm0408_test.c
M tests/gsm0408/gsm0408_test.ok
2 files changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 87f8dde..aa6a8be 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -132,7 +132,7 @@
 
 static inline void dump_ra(const struct gprs_ra_id *raid)
 {
-	printf("RA: MCC=%u, MNC=%u, LAC=%u, RAC=%u\n", raid->mcc, raid->mnc, raid->lac, raid->rac);
+	printf("%03u-%02u-%u-%u\n", raid->mcc, raid->mnc, raid->lac, raid->rac);
 }
 
 static inline void check_ra(const struct gprs_ra_id *raid)
@@ -150,6 +150,7 @@
 
 	gsm48_parse_ra(&raid0, (const uint8_t *)&ra);
 	dump_ra(raid);
+	printf("MCC+MNC in BCD: %s\n", osmo_hexdump(ra.digits, sizeof(ra.digits)));
 	dump_ra(&raid0);
 	printf("RA test...");
 	if (raid->mnc != raid0.mnc || raid->mcc != raid0.mcc || raid->lac != raid0.lac || raid->rac != raid0.rac)
diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok
index 295d8ec..a3d801d 100644
--- a/tests/gsm0408/gsm0408_test.ok
+++ b/tests/gsm0408/gsm0408_test.ok
@@ -3,10 +3,12 @@
 Simple TMSI encoding test....passed
 Simple IMSI encoding test....passed: [10] 17 08 99 10 07 00 00 00 64 02 
 Constructed RA:
-RA: MCC=77, MNC=121, LAC=666, RAC=5
-RA: MCC=77, MNC=121, LAC=666, RAC=5
+077-121-666-5
+MCC+MNC in BCD: 70 17 21 
+077-121-666-5
 RA test...passed
 Constructed RA:
-RA: MCC=84, MNC=98, LAC=11, RAC=89
-RA: MCC=84, MNC=98, LAC=11, RAC=89
+084-98-11-89
+MCC+MNC in BCD: 80 f4 89 
+084-98-11-89
 RA test...passed

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f8ae05fa3e4a6fc004212757b05ca8a14c9ef45
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list