Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
- index 2e71123..e7c9776 100644
- --- a/library/Osmocom_Types.ttcn
- +++ b/library/Osmocom_Types.ttcn
- @@ -178,5 +178,31 @@ function f_pad_bcd_number(hexstring number) return hexstring {
- }
- }
- +/* Presence bits are heavily used in CSN.1: { 0 | 1 < field > } */
- +function f_pres_bit(template (omit) anytype field) return BIT1
- +{
- + if (not istemplatekind(field, "omit")) {
- + return '1'B;
- + } else {
- + return '0'B;
- + }
- +}
- +
- +/* Unfortunately, this trick does not work:
- + * TITAN error: Reference to non-existent field `OCT1' in union template for type `@Osmocom_Types.anytype'
- + * TITAN note: @Osmocom_Types.anytype has no fields */
- +testcase TC_f_pres_bit() runs on CT_TUWAT {
- + var template (omit) OCT1 field;
- + var BIT1 field_ind;
- +
- + field := '2B'O;
- + field_ind := f_pres_bit({ OCT1 := field });
- + log("Test #1: field=", field, " field_ind=", field_ind);
- +
- + field := omit;
- + field_ind := f_pres_bit({ OCT1 := field });
- + log("Test #2: field=", field, " field_ind=", field_ind);
- +}
- +
- } with { encode "RAW"; variant "FIELDORDER(msb)" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement