Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / text2ttcn / hexstring_test.ttcn
CommitLineData
970ed795 1/******************************************************************************
3abe9331 2 * Copyright (c) 2000-2015 Ericsson Telecom AB
970ed795
EL
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/*
9//AUTHOR:
10//DATE:
11//VERSION:
12*/
13module hexstring_test
14{
15
16//=========================================================================
17// Import Part
18//=========================================================================
19import from types all;
20import from functions all;
21
22//=========================================================================
23// Module Parameters
24//=========================================================================
25modulepar {
26
27
28 //hexstring
29 //============================================================
30 //================ Type: hexstring ==========================
31 //============================================================
32
33 //modulepar hexstrings not modified from cfg file
34 template hexstring tspt_hs_v := 'ABBA'H;
35 template hexstring tspt_hs_o := omit;
36 template hexstring tspt_hs_a := *;
37 template hexstring tspt_hs_q := ?;
38 template hexstring tspt_hs_al1 := * length(2); //length restriction
39 template hexstring tspt_hs_al2 := * length(2..4);
40 template hexstring tspt_hs_ql1 := ? length(2);
41 template hexstring tspt_hs_ql2 := ? length(2..4);
42 template hexstring tspt_hs_vl1 := ('ABBA'H);
43 template hexstring tspt_hs_vl2 := ('ABBA'H,'baba'H);
44 template hexstring tspt_hs_vl3 := ('ABBA'H,'baba'H,'B12'H);
45 template hexstring tspt_hs_c1 := complement('ABBA'H)
46 template hexstring tspt_hs_c2 := complement('ABBA'H,'baba'H);
47 template hexstring tspt_hs_c3 := complement('ABBA'H,'baba'H,'B12'H);
48 //template hexstring tspt_hs_r1 := ('A'H..'B'H); //range not allowed
49 //template hexstring tspt_hs_r2 := ('a'H..'c'H);
50 template hexstring tspt_hs_pa := 'abc*123'H
51 template hexstring tspt_hs_pq := 'abc?123'H
52
53 template hexstring tspt_hs_vifp := 'ABBA'H ifpresent;
54 template hexstring tspt_hs_oifp := omit ifpresent;
55 template hexstring tspt_hs_aifp := * ifpresent;
56 template hexstring tspt_hs_qifp := ? ifpresent;
57 template hexstring tspt_hs_al1ifp := * length(2) ifpresent; //length restriction
58 template hexstring tspt_hs_al2ifp := * length(2..4) ifpresent;
59 template hexstring tspt_hs_ql1ifp := ? length(2) ifpresent;
60 template hexstring tspt_hs_ql2ifp := ? length(2..4) ifpresent;
61 template hexstring tspt_hs_vl1ifp := ('ABBA'H) ifpresent;
62 template hexstring tspt_hs_vl2ifp := ('ABBA'H,'baba'H) ifpresent;
63 template hexstring tspt_hs_vl3ifp := ('ABBA'H,'baba'H,'B12'H) ifpresent;
64 template hexstring tspt_hs_c1ifp := complement('ABBA'H) ifpresent
65 template hexstring tspt_hs_c2ifp := complement('ABBA'H,'baba'H) ifpresent;
66 template hexstring tspt_hs_c3ifp := complement('ABBA'H,'baba'H,'B12'H) ifpresent;
67 //template hexstring tspt_hs_r1ifp := ('A'H..'B'H) ifpresent; //range not allowed
68 //template hexstring tspt_hs_r2ifp := ('a'H..'c'H) ifpresent; //range not allowed
69 template hexstring tspt_hs_paifp := 'abc*123'H ifpresent
70 template hexstring tspt_hs_pqifp := 'abc?123'H ifpresent
71
72 //modulepar hexstrings modified from cfg file
73 template hexstring tspt_hs_mod4v := * //after mod:'ABBA';
74 template hexstring tspt_hs_mod4o := * //omit;
75 template hexstring tspt_hs_mod4a := 'A'H //*;
76 template hexstring tspt_hs_mod4q := ''H //?;
77 template hexstring tspt_hs_mod4al1 := 'A'H //* length(2); //length restriction
78 template hexstring tspt_hs_mod4al2 := '12345'H //mofified for: * length(2..4);
79 template hexstring tspt_hs_mod4ql1 := '12345'H //mofified for:? length(2);
80 template hexstring tspt_hs_mod4ql2 := '12345'H //mofified for:? length(2..4);
81 template hexstring tspt_hs_mod4vl1 := ('ABBA'H) //TODO: Adam //It should be mofified for: ('ABBA'H);
82 template hexstring tspt_hs_mod4vl2 := '12345'H //mofified for:('ABBA'H,'baba'H);
83 template hexstring tspt_hs_mod4vl3 := '12345'H //mofified for:('ABBA'H,'baba'H,'B12'H);
84 template hexstring tspt_hs_mod4c1 := '12345'H //mofified for:complement('ABBA')
85 template hexstring tspt_hs_mod4c2 := '12345'H //mofified for:complement('ABBA','baba');
86 template hexstring tspt_hs_mod4c3 := '12345'H //mofified for:complement('ABBA','baba','Bye');
87 template hexstring tspt_hs_mod4r1 := '12345'H //mofified for:('A'..'B'); //range
88 template hexstring tspt_hs_mod4r2 := '12345'H //mofified for:('a'..'c');
89 template hexstring tspt_hs_mod4pa := '12345'H //mofified for:pattern 'abc*123'
90 template hexstring tspt_hs_mod4pq := '12345'H //mofified for:pattern 'abc?123'
91
92 template hexstring tspt_hs_mod4vifp := '12345'H //mofified for:'ABBA' ifpresent;
93 template hexstring tspt_hs_mod4oifp := '12345'H //mofified for:omit ifpresent;
94 template hexstring tspt_hs_mod4aifp := '12345'H //mofified for:* ifpresent;
95 template hexstring tspt_hs_mod4qifp := '12345'H //mofified for:? ifpresent;
96 template hexstring tspt_hs_mod4al1ifp := '12345'H //mofified for:* length(2) ifpresent; //length restriction
97 template hexstring tspt_hs_mod4al2ifp := '12345'H //mofified for:* length(2..4) ifpresent;
98 template hexstring tspt_hs_mod4ql1ifp := '12345'H //mofified for:? length(2) ifpresent;
99 template hexstring tspt_hs_mod4ql2ifp := '12345'H //mofified for:? length(2..4) ifpresent;
100 template hexstring tspt_hs_mod4vl1ifp := ('ABBA'H) ifpresent //TODO: Adam //It should be mofified for: ('ABBA'H);
101 template hexstring tspt_hs_mod4vl2ifp := '12345'H //mofified for:('ABBA','baba') ifpresent;
102 template hexstring tspt_hs_mod4vl3ifp := '12345'H //mofified for:('ABBA','baba','B12') ifpresent;
103 template hexstring tspt_hs_mod4c1ifp := '12345'H //mofified for:complement('ABBA') ifpresent
104 template hexstring tspt_hs_mod4c2ifp := '12345'H //mofified for:complement('ABBA','baba') ifpresent;
105 template hexstring tspt_hs_mod4c3ifp := '12345'H //mofified for:complement('ABBA','baba','Bye') ifpresent;
106 //template hexstring tspt_hs_mod4r1ifp := '12345'H //mofified for:('A'H..'B'H) ifpresent; //range
107 //template hexstring tspt_hs_mod4r2ifp := '12345'H //mofified for:('a'H..'c'H) ifpresent;
108 template hexstring tspt_hs_mod4paifp := '12345'H //mofified for:pattern 'abc*xyz'H ifpresent
109 template hexstring tspt_hs_mod4pqifp := '12345'H //mofified for:pattern 'abc?xyz'H ifpresent
110
111}
112
113//=========================================================================
114// Data Types
115//=========================================================================
116
117// Insert data type defintions here if applicable!
118// You can use the data_type skeleton!
119
120//=========================================================================
121// Signatures
122//=========================================================================
123
124// Insert signature definitions here if applicable!
125// You can use the signature skeleton!
126
127//=========================================================================
128//Port Types
129//=========================================================================
130
131// Insert port type defintions here if applicable!
132// You can use the port_type skeleton!
133
134//=========================================================================
135//Component Types
136//=========================================================================
137
138// Insert component type defintions here if applicable!
139// You can use the component_type skeleton!
140
141//=========================================================================
142// Constants
143//=========================================================================
144
145// Insert constants here if applicable!
146// You can use the constant skeleton!
147
148//=========================================================================
149// Templates
150//=========================================================================
151
152// Insert templates here if applicable!
153// You can use the template skeleton!
154
155//=========================================================================
156// Altsteps
157//=========================================================================
158
159// Insert altsteps here if applicable!
160// You can use the altstep skeleton!
161
162//=========================================================================
163// Functions
164//=========================================================================
165
166// Insert functions here if applicable!
167// You can use the function skeleton!
168
169//=========================================================================
170// Testcases
171//=========================================================================
172
173 testcase tc_hs_ModulePar_emb() runs on MC {
174 log(t_rhs(tspt_hs_mod4v));
175 if(log2str(t_rhs(tspt_hs_mod4v)) != "{ hs := \'ABBA\'H }") {setverdict(fail)} else {setverdict(pass)};
176 log(t_rhs(tspt_hs_mod4o));
177 if(log2str(t_rhs(tspt_hs_mod4o)) != "{ hs := omit }") {setverdict(fail)} else {setverdict(pass)};
178 log(t_rhs(tspt_hs_mod4a));
179 if(log2str(t_rhs(tspt_hs_mod4a)) != "{ hs := * }") {setverdict(fail)} else {setverdict(pass)};
180 log(t_rhs(tspt_hs_mod4q));
181 if(log2str(t_rhs(tspt_hs_mod4q)) != "{ hs := ? }") {setverdict(fail)} else {setverdict(pass)};
182 log(t_rhs(tspt_hs_mod4al1));
183 if(log2str(t_rhs(tspt_hs_mod4al1)) != "{ hs := * length (2) }") {setverdict(fail)} else {setverdict(pass)};
184 log(t_rhs(tspt_hs_mod4al2));
185 if(log2str(t_rhs(tspt_hs_mod4al2)) != "{ hs := * length (2 .. 4) }") {setverdict(fail)} else {setverdict(pass)};
186 log(t_rhs(tspt_hs_mod4ql1));
187 if(log2str(t_rhs(tspt_hs_mod4ql1)) != "{ hs := ? length (2) }") {setverdict(fail)} else {setverdict(pass)};
188 log(t_rhs(tspt_hs_mod4ql2));
189 if(log2str(t_rhs(tspt_hs_mod4ql2)) != "{ hs := ? length (2 .. 4) }") {setverdict(fail)} else {setverdict(pass)};
190 log(">",t_rhs(tspt_hs_mod4vl1),"<");
191 if(log2str(t_rhs(tspt_hs_mod4vl1)) != "{ hs := \'ABBA\'H }") {setverdict(fail)} else {setverdict(pass)};
192 log(t_rhs(tspt_hs_mod4vl2));
193 if(log2str(t_rhs(tspt_hs_mod4vl2)) != "{ hs := (\'ABBA\'H, \'BABA\'H) }") {setverdict(fail)} else {setverdict(pass)};
194 log(">{ hs := (\'ABBA\'H, \'BABA\'H) }<");
195 log(t_rhs(tspt_hs_mod4vl3));
196 if(log2str(t_rhs(tspt_hs_mod4vl3)) != "{ hs := (\'ABBA\'H, \'BABA\'H, \'B12\'H) }") {setverdict(fail)} else {setverdict(pass)};
197 log(t_rhs(tspt_hs_mod4c1));
198 if(log2str(t_rhs(tspt_hs_mod4c1)) != "{ hs := complement (\'ABBA\'H) }") {setverdict(fail)} else {setverdict(pass)};
199 log(t_rhs(tspt_hs_mod4c2));
200 if(log2str(t_rhs(tspt_hs_mod4c2)) != "{ hs := complement (\'ABBA\'H, \'BABA\'H) }") {setverdict(fail)} else {setverdict(pass)};
201 log(t_rhs(tspt_hs_mod4c3));
202 if(log2str(t_rhs(tspt_hs_mod4c3)) != "{ hs := complement (\'ABBA\'H, \'BABA\'H, \'B12\'H) }") {setverdict(fail)} else {setverdict(pass)};
203 log(t_rhs(tspt_hs_mod4pa));
204 if(log2str(t_rhs(tspt_hs_mod4pa)) != "{ hs := \'ABC*123\'H }") {setverdict(fail)} else {setverdict(pass)};
205 log(t_rhs(tspt_hs_mod4pq));
206 if(log2str(t_rhs(tspt_hs_mod4pq)) != "{ hs := \'ABC?123\'H }") {setverdict(fail)} else {setverdict(pass)};
207 //==
208 log(t_rhs(tspt_hs_mod4vifp));
209 if(log2str(t_rhs(tspt_hs_mod4vifp)) != "{ hs := \'ABBA\'H ifpresent }") {setverdict(fail)} else {setverdict(pass)};
210 log(t_rhs(tspt_hs_mod4oifp));
211 if(log2str(t_rhs(tspt_hs_mod4oifp)) != "{ hs := omit ifpresent }") {setverdict(fail)} else {setverdict(pass)};
212 log(t_rhs(tspt_hs_mod4aifp));
213 if(log2str(t_rhs(tspt_hs_mod4aifp)) != "{ hs := * ifpresent }") {setverdict(fail)} else {setverdict(pass)};
214 log(t_rhs(tspt_hs_mod4qifp));
215 if(log2str(t_rhs(tspt_hs_mod4qifp)) != "{ hs := ? ifpresent }") {setverdict(fail)} else {setverdict(pass)};
216 log(t_rhs(tspt_hs_mod4al1ifp));
217 if(log2str(t_rhs(tspt_hs_mod4al1ifp)) != "{ hs := * length (2) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
218 log(t_rhs(tspt_hs_mod4al2ifp));
219 if(log2str(t_rhs(tspt_hs_mod4al2ifp)) != "{ hs := * length (2 .. 4) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
220 log(t_rhs(tspt_hs_mod4ql1ifp));
221 if(log2str(t_rhs(tspt_hs_mod4ql1ifp)) != "{ hs := ? length (2) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
222 log(t_rhs(tspt_hs_mod4ql2ifp));
223 if(log2str(t_rhs(tspt_hs_mod4ql2ifp)) != "{ hs := ? length (2 .. 4) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
224 log(t_rhs(tspt_hs_mod4vl1ifp));
225 if(log2str(t_rhs(tspt_hs_mod4vl1ifp)) != "{ hs := \'ABBA\'H ifpresent }") {setverdict(fail)} else {setverdict(pass)};
226 log(t_rhs(tspt_hs_mod4vl2ifp));
227 if(log2str(t_rhs(tspt_hs_mod4vl2ifp)) != "{ hs := (\'ABBA\'H, \'BABA\'H) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
228 log(t_rhs(tspt_hs_mod4vl3ifp));
229 if(log2str(t_rhs(tspt_hs_mod4vl3ifp)) != "{ hs := (\'ABBA\'H, \'BABA\'H, \'B12\'H) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
230 log(t_rhs(tspt_hs_mod4c1ifp));
231 if(log2str(t_rhs(tspt_hs_mod4c1ifp)) != "{ hs := complement (\'ABBA\'H) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
232 log(t_rhs(tspt_hs_mod4c2ifp));
233 if(log2str(t_rhs(tspt_hs_mod4c2ifp)) != "{ hs := complement (\'ABBA\'H, \'BABA\'H) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
234 log(t_rhs(tspt_hs_mod4c3ifp));
235 if(log2str(t_rhs(tspt_hs_mod4c3ifp)) != "{ hs := complement (\'ABBA\'H, \'BABA\'H, \'B12\'H) ifpresent }") {setverdict(fail)} else {setverdict(pass)};
236 log(t_rhs(tspt_hs_mod4paifp));
237 if(log2str(t_rhs(tspt_hs_mod4paifp)) != "{ hs := \'ABC*123'H ifpresent }") {setverdict(fail)} else {setverdict(pass)};
238 log(t_rhs(tspt_hs_mod4pqifp));
239 if(log2str(t_rhs(tspt_hs_mod4pqifp)) != "{ hs := \'ABC?123\'H ifpresent }") {setverdict(fail)} else {setverdict(pass)};
240 }
241
242
243//=========================================================================
244// Control
245//=========================================================================
246
247control {
248 log("***hexstring tests****");
249 execute(tc_hs_ModulePar_emb());
250}
251
252
253} // end of module
This page took 0.035745 seconds and 5 git commands to generate.