[PATCH] libosmocore[master]: gsm0408_test: check for new mnc_3_digits flag

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Feb 22 05:45:50 UTC 2018


gsm0408_test: check for new mnc_3_digits flag

Note that on the input side, the 3-digits flag may be left false when the MNC
is >99 anyway. On the decoded side, the flag is set accurately.

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


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/60/6660/2

diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index a0e740a..9e552ab 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("%03u-%02u-%u-%u\n", raid->mcc, raid->mnc, raid->lac, raid->rac);
+	printf("%s%s\n", osmo_rai_name(raid), raid->mnc_3_digits ? " (3-digit MNC)" : "");
 }
 
 static inline void check_ra(const struct gprs_ra_id *raid)
@@ -153,7 +153,8 @@
 	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)
+	if (raid->mnc != raid0.mnc || raid->mcc != raid0.mcc || raid->lac != raid0.lac || raid->rac != raid0.rac
+	    || (raid->mnc_3_digits || raid->mnc > 99) != raid0.mnc_3_digits)
 		printf("FAIL\n");
 	else
 		printf("passed\n");
diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok
index 7612c12..cc56763 100644
--- a/tests/gsm0408/gsm0408_test.ok
+++ b/tests/gsm0408/gsm0408_test.ok
@@ -5,7 +5,7 @@
 Constructed RA:
 077-121-666-5
 MCC+MNC in BCD: 70 17 21 
-077-121-666-5
+077-121-666-5 (3-digit MNC)
 RA test...passed
 Constructed RA:
 084-98-11-89
@@ -20,7 +20,7 @@
 Constructed RA:
 999-999-65535-255
 MCC+MNC in BCD: 99 99 99 
-999-999-65535-255
+999-999-65535-255 (3-digit MNC)
 RA test...passed
 - gsm48_generate_lai() from 077-121-666-0
   Encoded 70 17 21 02 9a 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I89765613d8c5bd939a6957f7443ac88475f1b93c
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list