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'://
10 type component PDTestComponent {};
12 /*--- CHAR2INT --------------------------------------------------*/
14 const charstring c2icons := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
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)
23 testcase char_to_int() runs on PDTestComponent{ //^In testcase definition//
26 and (c2icon1 == char2int("A")))
28 else {setverdict(fail);} //^In else statement// \
29 //^warning: Control never reaches this code because of previous effective condition\(s\)//
31 and (c2icon2 == char2int("\n")))
33 else {setverdict(fail);} //^In else statement// \
34 //^warning: Control never reaches this code because of previous effective condition\(s\)//
36 and (c2icon3 == char2int("" & "A" & "")))
38 else {setverdict(fail);} //^In else statement// \
39 //^warning: Control never reaches this code because of previous effective condition\(s\)//
41 and (c2icon4 == char2int(substr(c2icons,0,1))))
43 else {setverdict(fail);} //^In else statement// \
44 //^warning: Control never reaches this code because of previous effective condition\(s\)//
46 and (c2icon5 == char2int("A" @> 1)))
48 else {setverdict(fail);} //^In else statement// \
49 //^warning: Control never reaches this code because of previous effective condition\(s\)//
52 /*--- UNICHAR2INT --------------------------------------------------*/
54 const universal charstring uc2icons := char(0,0,0,65) & "BCDEFGHIJKLMNOPQRSTUVWXYZ"
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))
66 testcase unichar_to_int() runs on PDTestComponent{ //^In testcase definition//
69 and (uc2icon1 == unichar2int("A")))
71 else {setverdict(fail);} //^In else statement// \
72 //^warning: Control never reaches this code because of previous effective condition\(s\)//
74 and (uc2icon2 == unichar2int(char(0,0,0,65))))
76 else {setverdict(fail);} //^In else statement// \
77 //^warning: Control never reaches this code because of previous effective condition\(s\)//
79 and (uc2icon3 == unichar2int("" & char(0,0,0,65) & "")))
81 else {setverdict(fail);} //^In else statement// \
82 //^warning: Control never reaches this code because of previous effective condition\(s\)//
84 and (uc2icon4 == unichar2int(substr(uc2icons,0,1))))
86 else {setverdict(fail);} //^In else statement// \
87 //^warning: Control never reaches this code because of previous effective condition\(s\)//
89 and (uc2icon5 == unichar2int(char(0,0,0,255))))
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))))
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))))
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))))
106 else {setverdict(fail);} //^In else statement// \
107 //^warning: Control never reaches this code because of previous effective condition\(s\)//
110 /*--- CHAR2OCT --------------------------------------------------*/
112 const charstring c2ocons := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
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)
120 testcase char_to_oct() runs on PDTestComponent{ //^In testcase definition//
122 if ((c2ocon1 == '41'O)
123 and (c2ocon1 == char2oct("A")))
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")))
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" & "")))
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))))
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)))
145 else {setverdict(fail);} //^In else statement// \
146 //^warning: Control never reaches this code because of previous effective condition\(s\)//
150 execute (char_to_int());
151 execute (unichar_to_int());
152 execute (char_to_oct());