neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37883?usp=email )
Change subject: hnbgw: tweak errmsg counter mismatch ......................................................................
hnbgw: tweak errmsg counter mismatch
- instead of "-1", print "not present", so humans know what is happening. - the comma separated args in setverdict() create a lot of weird quotes. Use string concatenation to have only one set of quotes around the entire error message.
Related: OS#6545 Change-Id: I672fcef819a6542a5b3bcfa0a6d9c84d34b468f3 --- M library/Osmocom_CTRL_Functions.ttcn 1 file changed, 12 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/83/37883/1
diff --git a/library/Osmocom_CTRL_Functions.ttcn b/library/Osmocom_CTRL_Functions.ttcn index 97863c8..b3a935b 100644 --- a/library/Osmocom_CTRL_Functions.ttcn +++ b/library/Osmocom_CTRL_Functions.ttcn @@ -317,6 +317,14 @@ f_counter_name_vals_set(vals[instance_nr], countername, val); }
+ private function f_counter_val_to_str(integer val) return charstring + { + if (val < 0) { + return "not present"; + } + return int2str(val); + } + /* For a specific instance, call f_counter_name_vals_get() and compare with expected counter values. * Set the test verdict accordingly. */ function f_counter_name_vals_expect(IPA_CTRL_PT pt, charstring instance_name, integer instance_nr, @@ -328,9 +336,10 @@ setverdict(fail, "Internal error"); } if (last[i].val != vals[i].val) { - setverdict(fail, "Rate counter mismatch: ", instance_name, " ", - f_ctrl_ctr_resolve_instance_id(instance_nr, instance_id_map), - " ", vals[i].name, " is at ", last[i].val, " but expected ", vals[i].val); + setverdict(fail, "Rate counter mismatch: " & instance_name & " " + & f_ctrl_ctr_resolve_instance_id(instance_nr, instance_id_map) + & " " & vals[i].name & " is " & f_counter_val_to_str(last[i].val) + & " but expected " & f_counter_val_to_str(vals[i].val)); } } setverdict(pass);