fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31277 )


Change subject: library/GSM_Types: rename f_{enc->build}_BcdMccMnc[_int]()
......................................................................

library/GSM_Types: rename f_{enc->build}_BcdMccMnc[_int]()

The enc_* functions usually return an octetstring.  However, both
f_enc_BcdMccMnc[_int]() return a sub-type of hexstring (BcdMccMnc),
so let's rename them to avoid confusion.

A follow-up patch adds the actual encoding function for BcdMccMnc.

Change-Id: I0332fe7396310da49910e89571f7181fb1604182
---
M library/GSM_Types.ttcn
M pcu/PCU_Tests.ttcn
2 files changed, 16 insertions(+), 16 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/77/31277/1

diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 0068cb8..d48dc6c 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -436,7 +436,7 @@
 type GsmBcdString BcdMccMnc with { variant "FIELDLENGTH(6)" };

 /* Compute BcdMccMnc from a pair of GsmMcc/GsmMnc values */
-function f_enc_BcdMccMnc(GsmMcc mcc, GsmMnc mnc) return BcdMccMnc {
+function f_build_BcdMccMnc(GsmMcc mcc, GsmMnc mnc) return BcdMccMnc {
        if (lengthof(mnc) == 2) {
                mnc := mnc[0] & mnc[1] & 'F'H;
        }
@@ -451,30 +451,30 @@
 }

 /* Compute BcdMccMnc from integer values */
-function f_enc_BcdMccMnc_int(uint16_t mcc, uint16_t mnc, boolean mnc_3_digits) 
return BcdMccMnc {
+function f_build_BcdMccMnc_int(uint16_t mcc, uint16_t mnc, boolean 
mnc_3_digits) return BcdMccMnc {
        var hexstring mcc_str := str2hex(int2str(mcc));
        var hexstring mnc_str := str2hex(int2str(mnc));
        if (mnc_3_digits == true) {
-               return f_enc_BcdMccMnc(mcc_str[0] & mcc_str[1] & mcc_str[2],
-                                      mnc_str[0] & mnc_str[1] & mnc_str[2]);
+               return f_build_BcdMccMnc(mcc_str[0] & mcc_str[1] & mcc_str[2],
+                                        mnc_str[0] & mnc_str[1] & mnc_str[2]);
        } else {
-               return f_enc_BcdMccMnc(mcc_str[0] & mcc_str[1] & mcc_str[2],
-                                      mnc_str[0] & mnc_str[1]);
+               return f_build_BcdMccMnc(mcc_str[0] & mcc_str[1] & mcc_str[2],
+                                        mnc_str[0] & mnc_str[1]);
        }
 }

-testcase TC_selftest_enc_BcdMccMnc() runs on Dummy_CT {
+testcase TC_selftest_BcdMccMnc() runs on Dummy_CT {
        if (not match('62F224'O, decmatch BcdMccMnc:'262F42'H)) { 
setverdict(fail); }
        if (not match('21F354'O, decmatch BcdMccMnc:'123F45'H)) { 
setverdict(fail); }
        if (not match('216354'O, decmatch BcdMccMnc:'123645'H)) { 
setverdict(fail); }

-       if (not match(f_enc_BcdMccMnc('262'H,  '42'H), BcdMccMnc:'262F42'H)) { 
setverdict(fail); }
-       if (not match(f_enc_BcdMccMnc('123'H,  '45'H), BcdMccMnc:'123F45'H)) { 
setverdict(fail); }
-       if (not match(f_enc_BcdMccMnc('123'H, '456'H), BcdMccMnc:'123645'H)) { 
setverdict(fail); }
+       if (not match(f_build_BcdMccMnc('262'H,  '42'H), BcdMccMnc:'262F42'H)) 
{ setverdict(fail); }
+       if (not match(f_build_BcdMccMnc('123'H,  '45'H), BcdMccMnc:'123F45'H)) 
{ setverdict(fail); }
+       if (not match(f_build_BcdMccMnc('123'H, '456'H), BcdMccMnc:'123645'H)) 
{ setverdict(fail); }

-       if (not match(f_enc_BcdMccMnc_int(262, 42, false), 
BcdMccMnc:'262F42'H)) { setverdict(fail); }
-       if (not match(f_enc_BcdMccMnc_int(123, 45, false), 
BcdMccMnc:'123F45'H)) { setverdict(fail); }
-       if (not match(f_enc_BcdMccMnc_int(123, 456, true), 
BcdMccMnc:'123645'H)) { setverdict(fail); }
+       if (not match(f_build_BcdMccMnc_int(262, 42, false), 
BcdMccMnc:'262F42'H)) { setverdict(fail); }
+       if (not match(f_build_BcdMccMnc_int(123, 45, false), 
BcdMccMnc:'123F45'H)) { setverdict(fail); }
+       if (not match(f_build_BcdMccMnc_int(123, 456, true), 
BcdMccMnc:'123645'H)) { setverdict(fail); }

        setverdict(pass);
 }
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index a537b96..affe41d 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -5134,7 +5134,7 @@

 private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind)
 runs on RAW_PCU_Test_CT {
-       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
+       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_build_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
                                                                    
info_ind.lac),
                                                             info_ind.rac),
                                                      info_ind.cell_id));
@@ -5159,7 +5159,7 @@
 altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean 
do_answer := true, boolean do_repeat := false)
 runs on RAW_PCU_Test_CT {
        /* RIM procedure: */
-       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
+       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_build_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1),
                                                                    
info_ind.lac),
                                                             info_ind.rac),
                                                      info_ind.cell_id));
@@ -5627,7 +5627,7 @@
        var GsmArfcn req_arfcn := 862;
        var uint6_t req_bsic := 43;
        var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != "";
-       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1), /* '262F42'H */
+       var BssgpCellId src := 
valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_build_BcdMccMnc_int(info_ind.mcc, 
info_ind.mnc, info_ind.mnc_3_digits == 1), /* '262F42'H */
                                                                    
info_ind.lac),
                                                             info_ind.rac),
                                                      info_ind.cell_id));

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31277
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I0332fe7396310da49910e89571f7181fb1604182
Gerrit-Change-Number: 31277
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to