Commit | Line | Data |
---|---|---|
4e4a3e2c AK |
1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Adrien Kirjak – initial implementation | |
10 | * | |
11 | ** @version 0.0.1 | |
12 | ** @purpose 1:15.8, Ensure that decoded content match is not allowed for omit template restriction | |
13 | ** @verdict pass reject, noexecution | |
14 | ***************************************************/ | |
15 | ||
16 | module NegSem_1508_TemplateRestrictions_050 { | |
17 | ||
18 | type record MessageType { | |
19 | hexstring payload | |
20 | } | |
21 | ||
22 | type record Mymessage { | |
23 | integer field1, | |
24 | bitstring field2 optional | |
4a43b62e | 25 | } with { variant " "}; |
4e4a3e2c AK |
26 | |
27 | ||
28 | type port loopbackPort message | |
29 | {inout MessageType} with {extension "internal"}; | |
30 | ||
31 | ||
32 | type component GeneralComp { | |
33 | port loopbackPort messagePort | |
34 | } | |
35 | ||
36 | testcase TC_NegSem_1508_TemplateRestrictions_050() runs on GeneralComp { | |
37 | var bitstring v_enc; | |
38 | var Mymessage v_testMessage; | |
39 | var MessageType Message; | |
40 | ||
41 | v_testMessage:= { | |
42 | field1 := 10, | |
43 | field2 := '1001'B | |
44 | } | |
45 | ||
46 | connect(self:messagePort,self:messagePort); | |
47 | ||
48 | Message.payload := bit2hex(encvalue(v_testMessage)); //encode message to payload | |
49 | ||
50 | template (omit) MessageType mw_matchingTemplate:= | |
51 | { | |
52 | payload := decmatch Mymessage: {field1:= 10, field2 := omit} | |
53 | //error: omit restriction not allowed | |
54 | } | |
55 | ||
56 | messagePort.send(Message); //send message | |
57 | ||
58 | alt { | |
59 | [] messagePort.receive(mw_matchingTemplate) { | |
60 | setverdict(pass); | |
61 | } | |
62 | [] messagePort.receive { | |
63 | setverdict(fail,mw_matchingTemplate); | |
64 | } | |
65 | } | |
66 | ||
67 | } | |
68 | ||
69 | control{ | |
70 | execute(TC_NegSem_1508_TemplateRestrictions_050()); | |
71 | } | |
72 | ||
4a43b62e | 73 | } with { encode "RAW"} |
4e4a3e2c | 74 |