Sync with 5.1.0
[deliverable/titan.core.git] / regression_test / predefFunction / float_to_SW.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 float_to_SW { //^In TTCN-3 module `float_to_SW'://
9
10type component PDTestComponent {};
11
12/*--- FLOAT2INT --------------------------------------------------*/
13
14
15const integer f2icon1 := float2int(5E-1)
16const integer f2icon2 := float2int(0.345)
17const integer f2icon3 := float2int(-0.345)
18const integer f2icon4 := float2int(-5E0)
19const integer f2icon5 := float2int(12345678910000.0)
20const integer f2icon6 := float2int(12345678910e+4)
21const integer f2icon7 := float2int(4294967296.0)
22
23testcase float_to_int() runs on PDTestComponent{ //In testcase definition//
24
25 if ((f2icon1 == 0)
26 and (f2icon1 == float2int(5E-1)))
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 ((f2icon2 == 0)
31 and (f2icon2 == float2int(0.345)))
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 ((f2icon3 == 0)
36 and (f2icon3 == float2int(-0.345)))
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 ((f2icon4 == -5)
41 and (f2icon4 == float2int(-5E0)))
42 {setverdict(pass);}
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)))
48 {setverdict(pass);}
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)))
53 {setverdict(pass);}
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)))
58 {setverdict(pass);}
59 else {setverdict(fail);} //^In else statement// \
60 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
61}
62
63/*--- FLOAT2STR --------------------------------------------------*/
64
65const charstring f2scon := "1234567890123456789012345678901234567890"
66
67const charstring f2scon1 := float2str(5E-1)
68const charstring f2scon2 := float2str(-5E-1)
69const charstring f2scon3 := float2str(0.345)
70const charstring f2scon4 := float2str(-0.345)
71const charstring f2scon5 := float2str(0.1234567)
72const charstring f2scon6 := float2str(123456748901.0)
73const charstring f2scon7 := float2str(123456758901.0)
74
75
76testcase float_to_str() runs on PDTestComponent{ //In testcase definition//
77
78 if ((f2scon1 == "0.500000")
79 and (f2scon1 == float2str(5E-1)))
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 ((f2scon2 == "-0.500000")
84 and (f2scon2 == float2str(-5E-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 ((f2scon3 == "0.345000")
89 and (f2scon3 == float2str(0.345)))
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 ((f2scon4 == "-0.345000")
94 and (f2scon4 == float2str(-0.345)))
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 ((f2scon5 == "0.123457")
99 and (f2scon5 == float2str(0.1234567)))
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 ((f2scon6 == "1.234567e+11")
104 and (f2scon6 == float2str(123456748901.0)))
105 {setverdict(pass);}
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)))
110 {setverdict(pass);}
111 else {setverdict(fail);} //^In else statement// \
112 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
113}
114
115control {
116 execute (float_to_int());
117 execute (float_to_str());
118}
119
120}
This page took 0.027011 seconds and 5 git commands to generate.