bsc CBSP: fix tr_CBSP_KILL_FAIL, no lengthof() on record-of with '*'
Keep a local next_idx so that lengthof() doesn't fail after adding a '*' entry.
Fixes this error in BSC_Tests_CBSP.TC_cbsp_write_then_kill:
Dynamic test case error: Performing lengthof() operation on a template of type @CBSP_Types.CBSP_IEs with no exact length.
Change-Id: I4d95a8ca311f145fa5ea371b6aed099db771d7b8
diff --git a/library/CBSP_Templates.ttcn b/library/CBSP_Templates.ttcn
index 49906fe..8d62742 100644
--- a/library/CBSP_Templates.ttcn
+++ b/library/CBSP_Templates.ttcn
@@ -581,20 +581,29 @@
tr_CbspMsgId(msg_id),
tr_OldSerNo(old_ser_nr)
};
+ /* As soon as adding a '*' IE item, lengthof() no longer works on the ies record. So keep track of the
+ * next index to use separately. */
+ var integer next_idx := lengthof(ies);
if (istemplatekind(compl_list, "*")) {
- ies[lengthof(ies)] := *;
+ ies[next_idx] := *;
+ next_idx := next_idx + 1;
} else if (not istemplatekind(compl_list, "omit")) {
- ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
+ ies[next_idx] := tr_CbspNumComplList(compl_list);
+ next_idx := next_idx + 1;
}
if (istemplatekind(cell_list, "*")) {
- ies[lengthof(ies)] := *;
+ ies[next_idx] := *;
+ next_idx := next_idx + 1;
} else if (not istemplatekind(cell_list, "omit")) {
- ies[lengthof(ies)] := tr_CbspCellList(cell_list);
+ ies[next_idx] := tr_CbspCellList(cell_list);
+ next_idx := next_idx + 1;
}
if (istemplatekind(channel_ind, "*")) {
- ies[lengthof(ies)] := *;
+ ies[next_idx] := *;
+ next_idx := next_idx + 1;
} else if (not istemplatekind(channel_ind, "omit")) {
- ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
+ ies[next_idx] := tr_CbspChannelInd(channel_ind);
+ next_idx := next_idx + 1;
}
return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies);
}