1 /******************************************************************************
2 * Copyright (c) 2000-2015 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 ******************************************************************************/
10 type component PDTestComponent {};
12 /*--- FLOAT2INT --------------------------------------------------*/
15 modulepar integer f2ipar1 := float2int(5E-1)
16 modulepar integer f2ipar2 := float2int(0.345)
17 modulepar integer f2ipar3 := float2int(-0.345)
18 modulepar integer f2ipar4 := float2int(-5E0)
19 modulepar integer f2ipar5 := float2int(12345678910000.0)
20 modulepar integer f2ipar6 := float2int(12345678910e+4)
21 modulepar integer f2ipar7 := float2int(4294967296.0)
23 testcase float_to_int() runs on PDTestComponent{
26 and (f2ipar1 == float2int(5E-1)))
28 else {setverdict(fail);}
30 and (f2ipar2 == float2int(0.345)))
32 else {setverdict(fail);}
34 and (f2ipar3 == float2int(-0.345)))
36 else {setverdict(fail);}
38 and (f2ipar4 == float2int(-5E0)))
40 else {setverdict(fail);}
41 // Tests added for HL22929.
42 if ((f2ipar5 == 12345678910000)
43 and (f2ipar5 == float2int(12345678910000.0)))
45 else {setverdict(fail);}
46 if ((f2ipar6 == 123456789100000)
47 and (f2ipar6 == float2int(12345678910e+4)))
49 else {setverdict(fail);}
50 if ((f2ipar7 == 4294967296)
51 and (f2ipar7 == float2int(4294967296.0)))
53 else {setverdict(fail);}
54 var float f2ivar1 := 12345678910000.0
55 var float f2ivar2 := 12345678910e+4
56 var float f2ivar3 := 4294967296.0
57 if ((float2int(f2ivar1) == 12345678910000)
58 and (float2int(f2ivar1) == float2int(12345678910000.0)))
60 else {setverdict(fail);}
61 if ((float2int(f2ivar2) == 123456789100000)
62 and (float2int(f2ivar2) == float2int(123456789100000.0)))
64 else {setverdict(fail);}
65 if ((float2int(f2ivar3) == 4294967296)
66 and (float2int(f2ivar3) == float2int(4294967296.0)))
68 else {setverdict(fail);}
72 /*--- FLOAT2STR --------------------------------------------------*/
74 modulepar charstring f2spar := "1234567890123456789012345678901234567890"
76 modulepar charstring f2spar1 := float2str(5E-1)
77 modulepar charstring f2spar2 := float2str(-5E-1)
78 modulepar charstring f2spar3 := float2str(0.345)
79 modulepar charstring f2spar4 := float2str(-0.345)
80 modulepar charstring f2spar5 := float2str(0.1234567)
81 modulepar charstring f2spar6 := float2str(123456748901.0)
82 modulepar charstring f2spar7 := float2str(123456758901.0)
85 testcase float_to_str() runs on PDTestComponent{
87 if ((f2spar1 == "0.500000")
88 and (f2spar1 == float2str(5E-1)))
90 else {setverdict(fail);}
91 if ((f2spar2 == "-0.500000")
92 and (f2spar2 == float2str(-5E-1)))
94 else {setverdict(fail);}
95 if ((f2spar3 == "0.345000")
96 and (f2spar3 == float2str(0.345)))
98 else {setverdict(fail);}
99 if ((f2spar4 == "-0.345000")
100 and (f2spar4 == float2str(-0.345)))
102 else {setverdict(fail);}
103 if ((f2spar5 == "0.123457")
104 and (f2spar5 == float2str(0.1234567)))
106 else {setverdict(fail);}
107 if ((f2spar6 == "1.234567e+11")
108 and (f2spar6 == float2str(123456748901.0)))
110 else {setverdict(fail);}
111 if ((f2spar7 == "1.234568e+11")
112 and (f2spar7 == float2str(123456758901.0)))
114 else {setverdict(fail);}
119 execute (float_to_int());
120 execute (float_to_str());