conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 27_specifying_attributes / 2707_optional_attributes / Sem_2707_OptionalAttributes_005.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:27.7, Ensure that the IUT correctly handles attribute definitions and their scoping rules
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 module Sem_2707_OptionalAttributes_005 {
17
18 type enumerated EnumeratedType {e_black, e_white};
19
20 type record RecordType {
21 integer a optional,
22 integer b optional,
23 boolean c
24 }
25
26 type set SetType {
27 integer a optional,
28 integer b optional,
29 boolean c
30 }
31
32 type record length (1..2) of integer IntegerList;
33
34 type set length (1..2) of integer IntegerUList;
35
36 type union UnionType {
37 integer a,
38 EnumeratedType b,
39 boolean c
40 }
41
42 type record MessageType {
43 integer field1,
44 charstring field2,
45 boolean field3,
46 integer field4[4],
47 EnumeratedType field5,
48 RecordType field6,
49 SetType field7,
50 UnionType field8,
51 IntegerList field9,
52 IntegerUList field10
53 }
54
55 template MessageType mw_matchingTemplate:=
56 {
57 field1 := 1,
58 field2 := "test string",
59 field3 := true,
60 field4 := {1,2,3,4},
61 field5 := e_black,
62 field6 := {b:=3,c:=true}, //a is omitted
63 field7 := {a:=3,c:=true}, //b is omitted
64 field8 := {a:=1},
65 field9 := {1},
66 field10 := {1,2}
67 } with { optional "implicit omit"} //with { optional (field6,field7) "implicit omit"} not work
68
69
70 const MessageType c_testMessage:= {
71 field1 := 1,
72 field2 := "test string",
73 field3 := true,
74 field4 := {1,2,3,4},
75 field5 := e_black,
76 field6 := {a:=3,b:=3,c:=true},
77 field7 := {a:=3,b:=3,c:=true},
78 field8 := {a:=1},
79 field9 := {1},
80 field10 := {1,2}
81 }
82
83 type port loopbackPort message {
84 inout MessageType
85 } with {extension "internal"}
86
87 type component GeneralComp {
88 port loopbackPort messagePort
89 }
90
91 testcase TC_Sem_2707_OptionalAttributes_005() runs on GeneralComp {
92
93 connect(self:messagePort, self:messagePort);
94
95 var MessageType v_testMessage:=c_testMessage;
96
97 messagePort.send(v_testMessage);
98
99 alt {
100 [] messagePort.receive(mw_matchingTemplate) {
101 setverdict(fail);
102 }
103 [] messagePort.receive {
104 setverdict(pass);
105 }
106 }
107 }
108
109 control{
110 execute(TC_Sem_2707_OptionalAttributes_005());
111 }
112
113 } with { optional "explicit omit"}
This page took 0.033689 seconds and 5 git commands to generate.