Change in osmo-ttcn3-hacks[master]: bsc CBSP: f_gen_page(): fix generated payload size range

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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 13 05:36:29 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19587 )

Change subject: bsc CBSP: f_gen_page(): fix generated payload size range
......................................................................

bsc CBSP: f_gen_page(): fix generated payload size range

Fix the length calculation to provide a range of [1..82].

f_rnd_int() generates [0..max[ (i.e., < max), so f_gen_page() so far has a
payload len range of [0..81]. We want no zero payload, and we want a maximum of
82 bytes (page max of 88 minus 6 header bytes).

Change-Id: Id521b6038a23dc8e71ea25475bcdef7bc8917531
---
M bsc/BSC_Tests_CBSP.ttcn
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index 2399c3a..f54de9b 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -136,7 +136,10 @@
 }
 
 function f_gen_page() return CBSP_IE {
-	var integer len := f_rnd_int(82);
+	/* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page: the
+	 * maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero length).
+	 * note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
+	var integer len := 1 + f_rnd_int(82);
 	var octetstring payload := f_rnd_octstring(len);
 	return valueof(ts_CbspMsgContent(payload, len));
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19587
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: Id521b6038a23dc8e71ea25475bcdef7bc8917531
Gerrit-Change-Number: 19587
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200813/bc765406/attachment.htm>


More information about the gerrit-log mailing list