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


Change subject: move f_str_split() from UPF_Tests to Osmocom_VTY_Functions
......................................................................

move f_str_split() from UPF_Tests to Osmocom_VTY_Functions

I want to use it in a new function f_verify_talloc_bytes() added to
Osmocom_VTY_Functions.ttcn in I2948ee6f167369a2252f85b493e9653b93c7e4e9.

Change-Id: I9ddd9977734efd7599481261f04df82620845cef
---
M library/Osmocom_VTY_Functions.ttcn
M upf/UPF_Tests.ttcn
2 files changed, 32 insertions(+), 17 deletions(-)



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

diff --git a/library/Osmocom_VTY_Functions.ttcn 
b/library/Osmocom_VTY_Functions.ttcn
index c7df53c..1bbe647 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -15,6 +15,7 @@
        import from TELNETasp_PortType all;
        import from Osmocom_Types all;
        import from TCCConversion_Functions all;
+       import from Socket_API_Definitions all;

        modulepar {
                charstring mp_prompt_prefix := "OpenBSC";
@@ -291,4 +292,23 @@
        mtc.stop;
 }

+public function f_str_split(charstring str, charstring delim := "\n") return 
ro_charstring
+{
+       var integer pos := 0;
+       var ro_charstring parts := {};
+       var integer delim_pos;
+       var integer end := lengthof(str);
+       while (pos < end) {
+               delim_pos := f_strstr(str, delim, pos);
+               if (delim_pos < 0) {
+                       delim_pos := end;
+               }
+               if (delim_pos > pos) {
+                       parts := parts & { substr(str, pos, delim_pos - pos) };
+               }
+               pos := delim_pos + 1;
+       }
+       return parts;
+}
+
 }
diff --git a/upf/UPF_Tests.ttcn b/upf/UPF_Tests.ttcn
index 5db143a..7dc01bb 100644
--- a/upf/UPF_Tests.ttcn
+++ b/upf/UPF_Tests.ttcn
@@ -76,23 +76,6 @@
        f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg);
 }

-private function f_str_split(charstring str, charstring delim := "\n") return 
ro_charstring
-{
-       var integer pos := 0;
-       var ro_charstring parts := {};
-       var integer delim_pos;
-       var integer end := lengthof(str);
-       while (pos < end) {
-               delim_pos := f_strstr(str, delim, pos);
-               if (delim_pos < 0) {
-                       delim_pos := end;
-               }
-               parts := parts & { substr(str, pos, delim_pos - pos) };
-               pos := delim_pos + 1;
-       }
-       return parts;
-}
-
 private function f_get_name_val(out charstring val, charstring str, charstring 
name, charstring sep := ":", charstring delim := " ") return boolean {
        var charstring labl := name & sep;
        var integer namepos := f_strstr(str, labl);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33478
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: I9ddd9977734efd7599481261f04df82620845cef
Gerrit-Change-Number: 33478
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to