neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33478 )
(
1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )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(-)
Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn index 6e3ee37..ed506a7 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"; @@ -290,4 +291,23 @@ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "talloc count mismatch"); }
+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);