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 float_to_SW { //^In TTCN-3 module `float_to_SW'://
10 type component PDTestComponent {};
12 /*--- FLOAT2INT --------------------------------------------------*/
15 const integer f2icon1 := float2int(5E-1)
16 const integer f2icon2 := float2int(0.345)
17 const integer f2icon3 := float2int(-0.345)
18 const integer f2icon4 := float2int(-5E0)
19 const integer f2icon5 := float2int(12345678910000.0)
20 const integer f2icon6 := float2int(12345678910e+4)
21 const integer f2icon7 := float2int(4294967296.0)
23 testcase float_to_int() runs on PDTestComponent{ //In testcase definition//
26 and (f2icon1 == float2int(5E-1)))
28 else {setverdict(fail);} //^In else statement// \
29 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
31 and (f2icon2 == float2int(0.345)))
33 else {setverdict(fail);} //^In else statement// \
34 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
36 and (f2icon3 == float2int(-0.345)))
38 else {setverdict(fail);} //^In else statement// \
39 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
41 and (f2icon4 == float2int(-5E0)))
43 else {setverdict(fail);} //^In else statement// \
44 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
45 // Tests added for HL22929.
46 if ((f2icon5 == 12345678910000)
47 and (f2icon5 == float2int(12345678910000.0)))
49 else {setverdict(fail);} //^In else statement// \
50 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
51 if ((f2icon6 == 123456789100000)
52 and (f2icon6 == float2int(12345678910e+4)))
54 else {setverdict(fail);} //^In else statement// \
55 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
56 if ((f2icon7 == 4294967296)
57 and (f2icon7 == float2int(4294967296.0)))
59 else {setverdict(fail);} //^In else statement// \
60 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
63 /*--- FLOAT2STR --------------------------------------------------*/
65 const charstring f2scon := "1234567890123456789012345678901234567890"
67 const charstring f2scon1 := float2str(5E-1)
68 const charstring f2scon2 := float2str(-5E-1)
69 const charstring f2scon3 := float2str(0.345)
70 const charstring f2scon4 := float2str(-0.345)
71 const charstring f2scon5 := float2str(0.1234567)
72 const charstring f2scon6 := float2str(123456748901.0)
73 const charstring f2scon7 := float2str(123456758901.0)
76 testcase float_to_str() runs on PDTestComponent{ //In testcase definition//
78 if ((f2scon1 == "0.500000")
79 and (f2scon1 == float2str(5E-1)))
81 else {setverdict(fail);} //^In else statement// \
82 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
83 if ((f2scon2 == "-0.500000")
84 and (f2scon2 == float2str(-5E-1)))
86 else {setverdict(fail);} //^In else statement// \
87 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
88 if ((f2scon3 == "0.345000")
89 and (f2scon3 == float2str(0.345)))
91 else {setverdict(fail);} //^In else statement// \
92 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
93 if ((f2scon4 == "-0.345000")
94 and (f2scon4 == float2str(-0.345)))
96 else {setverdict(fail);} //^In else statement// \
97 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
98 if ((f2scon5 == "0.123457")
99 and (f2scon5 == float2str(0.1234567)))
101 else {setverdict(fail);} //^In else statement// \
102 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
103 if ((f2scon6 == "1.234567e+11")
104 and (f2scon6 == float2str(123456748901.0)))
106 else {setverdict(fail);} //^In else statement// \
107 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
108 if ((f2scon7 == "1.234568e+11")
109 and (f2scon7 == float2str(123456758901.0)))
111 else {setverdict(fail);} //^In else statement// \
112 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
116 execute (float_to_int());
117 execute (float_to_str());