Sync with 5.1.0
[deliverable/titan.core.git] / regression_test / predefFunction / char_to_SW.ttcn
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 ******************************************************************************/
8 module char_to_SW { //^In TTCN-3 module `char_to_SW'://
9
10 type component PDTestComponent {};
11
12 /*--- CHAR2INT --------------------------------------------------*/
13
14 const charstring c2icons := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
15
16 const integer c2icon1 := char2int("A")
17 const integer c2icon2 := char2int("\n")
18 const integer c2icon3 := char2int("" & "A" & "")
19 const integer c2icon4 := char2int(substr(c2icons,0,1))
20 const integer c2icon5 := char2int("A" <@ 1)
21
22
23 testcase char_to_int() runs on PDTestComponent{ //^In testcase definition//
24
25 if ((c2icon1 == 65)
26 and (c2icon1 == char2int("A")))
27 {setverdict(pass);}
28 else {setverdict(fail);} //^In else statement// \
29 //^warning: Control never reaches this code because of previous effective condition\(s\)//
30 if ((c2icon2 == 10)
31 and (c2icon2 == char2int("\n")))
32 {setverdict(pass);}
33 else {setverdict(fail);} //^In else statement// \
34 //^warning: Control never reaches this code because of previous effective condition\(s\)//
35 if ((c2icon3 == 65)
36 and (c2icon3 == char2int("" & "A" & "")))
37 {setverdict(pass);}
38 else {setverdict(fail);} //^In else statement// \
39 //^warning: Control never reaches this code because of previous effective condition\(s\)//
40 if ((c2icon4 == 65)
41 and (c2icon4 == char2int(substr(c2icons,0,1))))
42 {setverdict(pass);}
43 else {setverdict(fail);} //^In else statement// \
44 //^warning: Control never reaches this code because of previous effective condition\(s\)//
45 if ((c2icon5 == 65)
46 and (c2icon5 == char2int("A" @> 1)))
47 {setverdict(pass);}
48 else {setverdict(fail);} //^In else statement// \
49 //^warning: Control never reaches this code because of previous effective condition\(s\)//
50 }
51
52 /*--- UNICHAR2INT --------------------------------------------------*/
53
54 const universal charstring uc2icons := char(0,0,0,65) & "BCDEFGHIJKLMNOPQRSTUVWXYZ"
55
56 const integer uc2icon1 := unichar2int("A")
57 const integer uc2icon2 := unichar2int(char(0,0,0,65))
58 const integer uc2icon3 := unichar2int("" & char(0,0,0,65) & "")
59 const integer uc2icon4 := unichar2int(substr(uc2icons,0,1))
60 const integer uc2icon5 := unichar2int(char(0,0,0,255))
61 const integer uc2icon6 := unichar2int(char(0,0,255,255))
62 const integer uc2icon7 := unichar2int(char(0,255,255,255))
63 const integer uc2icon8 := unichar2int(char(127,255,255,255))
64
65
66 testcase unichar_to_int() runs on PDTestComponent{ //^In testcase definition//
67
68 if ((uc2icon1 == 65)
69 and (uc2icon1 == unichar2int("A")))
70 {setverdict(pass);}
71 else {setverdict(fail);} //^In else statement// \
72 //^warning: Control never reaches this code because of previous effective condition\(s\)//
73 if ((uc2icon2 == 65)
74 and (uc2icon2 == unichar2int(char(0,0,0,65))))
75 {setverdict(pass);}
76 else {setverdict(fail);} //^In else statement// \
77 //^warning: Control never reaches this code because of previous effective condition\(s\)//
78 if ((uc2icon3 == 65)
79 and (uc2icon3 == unichar2int("" & char(0,0,0,65) & "")))
80 {setverdict(pass);}
81 else {setverdict(fail);} //^In else statement// \
82 //^warning: Control never reaches this code because of previous effective condition\(s\)//
83 if ((uc2icon4 == 65)
84 and (uc2icon4 == unichar2int(substr(uc2icons,0,1))))
85 {setverdict(pass);}
86 else {setverdict(fail);} //^In else statement// \
87 //^warning: Control never reaches this code because of previous effective condition\(s\)//
88 if ((uc2icon5 == 255)
89 and (uc2icon5 == unichar2int(char(0,0,0,255))))
90 {setverdict(pass);}
91 else {setverdict(fail);} //^In else statement// \
92 //^warning: Control never reaches this code because of previous effective condition\(s\)//
93 if ((uc2icon6 == 65535)
94 and (uc2icon6 == unichar2int(char(0,0,255,255))))
95 {setverdict(pass);}
96 else {setverdict(fail);} //^In else statement// \
97 //^warning: Control never reaches this code because of previous effective condition\(s\)//
98 if ((uc2icon7 == 16777215)
99 and (uc2icon7 == unichar2int(char(0,255,255,255))))
100 {setverdict(pass);}
101 else {setverdict(fail);} //^In else statement// \
102 //^warning: Control never reaches this code because of previous effective condition\(s\)//
103 if ((uc2icon8 == 2147483647)
104 and (uc2icon8 == unichar2int(char(127,255,255,255))))
105 {setverdict(pass);}
106 else {setverdict(fail);} //^In else statement// \
107 //^warning: Control never reaches this code because of previous effective condition\(s\)//
108 }
109
110 /*--- CHAR2OCT --------------------------------------------------*/
111
112 const charstring c2ocons := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
113
114 const octetstring c2ocon1 := char2oct("A")
115 const octetstring c2ocon2 := char2oct("\n")
116 const octetstring c2ocon3 := char2oct("" & "A" & "")
117 const octetstring c2ocon4 := char2oct(substr(c2ocons,0,1))
118 const octetstring c2ocon5 := char2oct("A" @> 1)
119
120 testcase char_to_oct() runs on PDTestComponent{ //^In testcase definition//
121
122 if ((c2ocon1 == '41'O)
123 and (c2ocon1 == char2oct("A")))
124 {setverdict(pass);}
125 else {setverdict(fail);} //^In else statement// \
126 //^warning: Control never reaches this code because of previous effective condition\(s\)//
127 if ((c2ocon2 == '0A'O)
128 and (c2ocon2 == char2oct("\n")))
129 {setverdict(pass);}
130 else {setverdict(fail);} //^In else statement// \
131 //^warning: Control never reaches this code because of previous effective condition\(s\)//
132 if ((c2ocon3 == '41'O)
133 and (c2ocon3 == char2oct("" & "A" & "")))
134 {setverdict(pass);}
135 else {setverdict(fail);} //^In else statement// \
136 //^warning: Control never reaches this code because of previous effective condition\(s\)//
137 if ((c2ocon4 == '41'O)
138 and (c2ocon4 == char2oct(substr(c2icons,0,1))))
139 {setverdict(pass);}
140 else {setverdict(fail);} //^In else statement// \
141 //^warning: Control never reaches this code because of previous effective condition\(s\)//
142 if ((c2ocon5 == '41'O)
143 and (c2ocon5 == char2oct("A" @> 1)))
144 {setverdict(pass);}
145 else {setverdict(fail);} //^In else statement// \
146 //^warning: Control never reaches this code because of previous effective condition\(s\)//
147 }
148
149 control {
150 execute (char_to_int());
151 execute (unichar_to_int());
152 execute (char_to_oct());
153 }
154
155 }
This page took 0.034412 seconds and 5 git commands to generate.