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