Sync with 5.1.0
[deliverable/titan.core.git] / regression_test / templateBool / TtemplateBool.ttcn
CommitLineData
970ed795
EL
1/******************************************************************************
2 * Copyright (c) 2000-2014 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 ******************************************************************************/
8module TtemplateBool {
9type component templateBool_mycomp {};
10type record templateBool_rec {
11 boolean x1,
12 boolean x2,
13 boolean x3 optional };
14template templateBool_rec templateBool_tSpec :={ //specific values
15 x1:=true,
16 x2:=false,
17 x3:=false };
18template templateBool_rec templateBool_tList :={ //specific value and value list
19 x1:=true,
20 x2:=(false),
21 x3:=false };
22template templateBool_rec templateBool_tComp :={ //specific value and compl. list
23 x1:=true,
24 x2:=complement (true),
25 x3:=false };
26template templateBool_rec templateBool_tOmit :={ //omitting values
27 x1:=true,
28 x2:=false,
29 x3:=omit } ;
30template templateBool_rec templateBool_tAny :={ //specific and any value
31 x1:=true,
32 x2:=false,
33 x3:=? } ;
34template templateBool_rec templateBool_tAnyorNone :={ //specific and AnyorNone value
35 x1:=true,
36 x2:=false,
37 x3:=* };
38template templateBool_rec templateBool_tIfpresent :={ //specific value and ifpresent
39 x1:=true,
40 x2:=false,
41 x3:=false ifpresent };
42
43testcase templateBoolSpec() runs on templateBool_mycomp {
44var templateBool_rec x1,x2; //specific value
45x1:={ x1:=true, x2:=false, x3:=false };
46x2:={ x1:=true, x2:=true, x3:=false };
47//match
48if (match(x1,templateBool_tSpec)) {setverdict(pass);}
49 else {setverdict(fail);}
50//no match
51if (not(match(x2,templateBool_tSpec))) {setverdict(pass);}
52 else {setverdict(fail);}
53}
54
55testcase templateBoolList() runs on templateBool_mycomp {
56var templateBool_rec x1,x2,x3; //value list
57x1:={ x1:=true, x2:=false, x3:=false };
58x2:={ x1:=true, x2:=true, x3:=false };
59x3:={ x1:=false, x2:=false, x3:=false };
60//match
61if (match(x1,templateBool_tList)) {setverdict(pass);}
62 else {setverdict(fail);}
63//no match: out of list
64if (not(match(x2,templateBool_tList))) {setverdict(pass);}
65 else {setverdict(fail);}
66//no match: other field
67if (not(match(x3,templateBool_tList))) {setverdict(pass);}
68 else {setverdict(fail);}
69}
70
71testcase templateBoolComp() runs on templateBool_mycomp {
72var templateBool_rec x1,x2,x3; //complemented list
73x1:={ x1:=true, x2:=false, x3:=false };
74x2:={ x1:=true, x2:=true, x3:=false };
75x3:={ x1:=false, x2:=false, x3:=false };
76//match
77if (match(x1,templateBool_tComp)) {setverdict(pass);}
78 else {setverdict(fail);}
79//no match: in the list
80if (not(match(x2,templateBool_tComp))) {setverdict(pass);}
81 else {setverdict(fail);}
82//no match: other field
83if (not(match(x3,templateBool_tComp))) {setverdict(pass);}
84 else {setverdict(fail);}
85}
86
87testcase templateBoolOmit() runs on templateBool_mycomp {
88var templateBool_rec x1,x2,x3; //omitting value
89x1:={ x1:=true, x2:=false, x3:=omit };
90x2:={ x1:=true, x2:=false, x3:=true };
91x3:={ x1:=false, x2:=false, x3:=omit };
92//match
93if (match(x1,templateBool_tOmit)) {setverdict(pass);}
94 else {setverdict(fail);}
95//no match: not omitted
96if (not(match(x2,templateBool_tOmit))) {setverdict(pass);}
97 else {setverdict(fail);}
98//no match: other field
99if (not(match(x3,templateBool_tOmit))) {setverdict(pass);}
100 else {setverdict(fail);}
101}
102
103testcase templateBoolAny() runs on templateBool_mycomp {
104var templateBool_rec x1,x2,x3; //any value
105x1:={ x1:=true, x2:=false, x3:=false };
106x2:={ x1:=true, x2:=false, x3:=omit };
107x3:={ x1:=false, x2:=false, x3:=false };
108//match
109if (match(x1,templateBool_tAny)) {setverdict(pass);}
110 else {setverdict(fail);}
111//no match: field omitted
112if (not(match(x2,templateBool_tAny))) {setverdict(pass);}
113 else {setverdict(fail);}
114//no match: other field
115if (not(match(x3,templateBool_tAny))) {setverdict(pass);}
116 else {setverdict(fail);}
117}
118
119testcase templateBoolAnyorNone() runs on templateBool_mycomp {
120var templateBool_rec x1,x2,x3; //AnyorNone value
121x1:={ x1:=true, x2:=false, x3:=omit };
122x2:={ x1:=true, x2:=false, x3:=true };
123x3:={ x1:=false, x2:=false, x3:=omit };
124//match: omitted
125if (match(x1,templateBool_tAnyorNone)) {setverdict(pass);}
126 else {setverdict(fail);}
127//match: value
128if (match(x2,templateBool_tAnyorNone)) {setverdict(pass);}
129 else {setverdict(fail);}
130//no match: other field
131if (not(match(x3,templateBool_tAnyorNone))) {setverdict(pass);}
132 else {setverdict(fail);}
133}
134
135testcase templateBoolIfpresent() runs on templateBool_mycomp {
136var templateBool_rec x1,x2,x3,x4; //ifpresent
137x1:={ x1:=true, x2:=false, x3:=false };
138x2:={ x1:=true, x2:=false, x3:=omit };
139x3:={ x1:=true, x2:=false, x3:=true };
140x4:={ x1:=false, x2:=false, x3:=omit };
141//match: present and match
142if (match(x1,templateBool_tIfpresent)) {setverdict(pass);}
143 else {setverdict(fail);}
144//match: not present
145if (match(x2,templateBool_tIfpresent)) {setverdict(pass);}
146 else {setverdict(fail);}
147//no match: present and not match
148if (not(match(x3,templateBool_tIfpresent))) {setverdict(pass);}
149 else {setverdict(fail);}
150//no match: other field
151if (not(match(x4,templateBool_tIfpresent))) {setverdict(pass);}
152 else {setverdict(fail);}
153}
154
155control {
156 execute(templateBoolSpec());
157 execute(templateBoolList());
158 execute(templateBoolComp());
159 execute(templateBoolOmit());
160 execute(templateBoolAny());
161 execute(templateBoolAnyorNone());
162 execute(templateBoolIfpresent());
163
164}
165}
This page took 0.028984 seconds and 5 git commands to generate.