conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 15_templates / 1508_template_restrictions / NegSem_1508_TemplateRestrictions_051.ttcn
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_051 {
17
18 type record MessageType {
19 hexstring payload
20 }
21
22 type record Mymessage {
23 integer field1,
24 bitstring field2 optional
25 }
26
27 type port loopbackPort message
28 {inout MessageType} {extension "internal"};
29
30 type component GeneralComp {
31 port loopbackPort messagePort
32 }
33
34 testcase TC_NegSem_1508_TemplateRestrictions_051() runs on GeneralComp {
35 var bitstring v_enc;
36 var Mymessage v_testMessage;
37 var MessageType Message;
38
39 v_testMessage:= {
40 field1 := 10,
41 field2 := '1001'B
42 }
43
44 Message.payload := bit2hex(encvalue(v_testMessage)); //encode message to payload
45
46 template (value) MessageType mw_matchingTemplate:=
47 {
48 payload := decmatch Mymessage: {field1:= 10, field2 := '1001'B}
49 //error: value restriction not allowed
50 }
51
52 messagePort.send(Message); //send message
53
54 alt {
55 [] messagePort.receive(mw_matchingTemplate) {
56 setverdict(pass);
57 }
58 [] messagePort.receive {
59 setverdict(fail,mw_matchingTemplate);
60 }
61 }
62
63 }
64
65 control{
66 execute(TC_NegSem_1508_TemplateRestrictions_051());
67 }
68
69 }
70
This page took 0.033567 seconds and 5 git commands to generate.