Skip to content
Snippets Groups Projects
Commit e00b3f4a authored by Elemer Lelik's avatar Elemer Lelik Committed by GitHub
Browse files

Merge pull request #83 from eadrkir/master

Added negative tests
parents 3bfabf9b 15185010
No related branches found
No related tags found
No related merge requests found
......@@ -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
.*---------------------------------------------------------------------*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment