diff --git a/conformance_test/negative_tests/15_templates.script b/conformance_test/negative_tests/15_templates.script index 7c70914a023471bf95a5b89f319d3580d6f710c5..536a2f8ff62b48e7426c5e059ef7c7680a32e3c3 100644 --- a/conformance_test/negative_tests/15_templates.script +++ b/conformance_test/negative_tests/15_templates.script @@ -3295,6 +3295,170 @@ error: Restriction on template does not allow usage of omit value <END_TC> :exmp +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_050 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that decoded content match is not allowed for omit template restriction > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_050 NegSem_1508_TemplateRestrictions_050.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that decoded content match is not allowed for omit template restriction + ** @verdict pass reject, noexecution + ***************************************************/ + +module NegSem_1508_TemplateRestrictions_050 { + + type record MessageType { + hexstring payload + } + + type record Mymessage { + integer field1, + bitstring field2 optional + } with { variant " "}; + + + type port loopbackPort message + {inout MessageType} with {extension "internal"}; + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_1508_TemplateRestrictions_050() runs on GeneralComp { + var bitstring v_enc; + var Mymessage v_testMessage; + var MessageType Message; + + v_testMessage:= { + field1 := 10, + field2 := '1001'B + } + + connect(self:messagePort,self:messagePort); + + Message.payload := bit2hex(encvalue(v_testMessage)); //encode message to payload + + template (omit) MessageType mw_matchingTemplate:= + { + payload := decmatch Mymessage: {field1:= 10, field2 := omit} + //error: omit restriction not allowed + } + + messagePort.send(Message); //send message + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail,mw_matchingTemplate); + } + } + + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_050()); + } + +} with { encode "RAW"} + +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of decoded content match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_051 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that decoded content match is not allowed for omit template restriction > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_051 NegSem_1508_TemplateRestrictions_051.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that decoded content match is not allowed for omit template restriction + ** @verdict pass reject, noexecution + ***************************************************/ + +module NegSem_1508_TemplateRestrictions_051 { + + type record MessageType { + hexstring payload + } + + type record Mymessage { + integer field1, + bitstring field2 optional + } with { variant " "}; + + type port loopbackPort message + {inout MessageType} with {extension "internal"}; + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_1508_TemplateRestrictions_051() runs on GeneralComp { + var bitstring v_enc; + var Mymessage v_testMessage; + var MessageType Message; + + v_testMessage:= { + field1 := 10, + field2 := '1001'B + } + + Message.payload := bit2hex(encvalue(v_testMessage)); //encode message to payload + + template (value) MessageType mw_matchingTemplate:= + { + payload := decmatch Mymessage: {field1:= 10, field2 := '1001'B} + //error: value restriction not allowed + } + + messagePort.send(Message); //send message + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail,mw_matchingTemplate); + } + } + + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_051()); + } + +} with { encode "RAW"} + +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of decoded content match +<END_RESULT> + +<END_TC> +:exmp + .*---------------------------------------------------------------------* :h2. 1509_match_operation folder .*---------------------------------------------------------------------*