Debian Codegraph @

rhino/testsrc/tests/ecma/Math/15.8.2.6.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '15.8.2.6.js';
7
8 /**
9 File Name: 15.8.2.6.js
10 ECMA Section: 15.8.2.6 Math.ceil(x)
11 Description: return the smallest number value that is not less than the
12 argument and is equal to a mathematical integer. if the
13 number is already an integer, return the number itself.
14 special cases:
15 - if x is NaN return NaN
16 - if x = +0 return +0
17 - if x = 0 return -0
18 - if x = Infinity return Infinity
19 - if x = -Infinity return -Infinity
20 - if ( -1 < x < 0 ) return -0
21 also:
22 - the value of Math.ceil(x) == -Math.ceil(-x)
23 Author: [email protected]
24 Date: 7 july 1997
25 */
26 var SECTION = "15.8.2.6";
27 var VERSION = "ECMA_1";
28 startTest();
29 var TITLE = "Math.ceil(x)";
30
31 writeHeaderToLog( SECTION + " "+ TITLE);
32
33 new TestCase( SECTION,
34 "Math.ceil.length",
35 1,
36 Math.ceil.length );
37
38 new TestCase( SECTION,
39 "Math.ceil(NaN)",
40 Number.NaN,
41 Math.ceil(Number.NaN) );
42
43 new TestCase( SECTION,
44 "Math.ceil(null)",
45 0,
46 Math.ceil(null) );
47
48 new TestCase( SECTION,
49 "Math.ceil()",
50 Number.NaN,
51 Math.ceil() );
52
53 new TestCase( SECTION,
54 "Math.ceil(void 0)",
55 Number.NaN,
56 Math.ceil(void 0) );
57
58 new TestCase( SECTION,
59 "Math.ceil('0')",
60 0,
61 Math.ceil('0') );
62
63 new TestCase( SECTION,
64 "Math.ceil('-0')",
65 -0,
66 Math.ceil('-0') );
67
68 new TestCase( SECTION,
69 "Infinity/Math.ceil('0')",
70 Infinity,
71 Infinity/Math.ceil('0'));
72
73 new TestCase( SECTION,
74 "Infinity/Math.ceil('-0')",
75 -Infinity,
76 Infinity/Math.ceil('-0'));
77
78 new TestCase( SECTION,
79 "Math.ceil(0)",
80 0,
81 Math.ceil(0) );
82
83 new TestCase( SECTION,
84 "Math.ceil(-0)",
85 -0,
86 Math.ceil(-0) );
87
88 new TestCase( SECTION,
89 "Infinity/Math.ceil(0)",
90 Infinity,
91 Infinity/Math.ceil(0));
92
93 new TestCase( SECTION,
94 "Infinity/Math.ceil(-0)",
95 -Infinity,
96 Infinity/Math.ceil(-0));
97
98
99 new TestCase( SECTION,
100 "Math.ceil(Infinity)",
101 Number.POSITIVE_INFINITY,
102 Math.ceil(Number.POSITIVE_INFINITY) );
103
104 new TestCase( SECTION,
105 "Math.ceil(-Infinity)",
106 Number.NEGATIVE_INFINITY,
107 Math.ceil(Number.NEGATIVE_INFINITY) );
108
109 new TestCase( SECTION,
110 "Math.ceil(-Number.MIN_VALUE)",
111 -0,
112 Math.ceil(-Number.MIN_VALUE) );
113
114 new TestCase( SECTION,
115 "Infinity/Math.ceil(-Number.MIN_VALUE)",
116 -Infinity,
117 Infinity/Math.ceil(-Number.MIN_VALUE) );
118
119 new TestCase( SECTION,
120 "Math.ceil(1)",
121 1,
122 Math.ceil(1) );
123
124 new TestCase( SECTION,
125 "Math.ceil(-1)",
126 -1,
127 Math.ceil(-1) );
128
129 new TestCase( SECTION,
130 "Math.ceil(-0.9)",
131 -0,
132 Math.ceil(-0.9) );
133
134 new TestCase( SECTION,
135 "Infinity/Math.ceil(-0.9)",
136 -Infinity,
137 Infinity/Math.ceil(-0.9) );
138
139 new TestCase( SECTION,
140 "Math.ceil(0.9 )",
141 1,
142 Math.ceil( 0.9) );
143
144 new TestCase( SECTION,
145 "Math.ceil(-1.1)",
146 -1,
147 Math.ceil( -1.1));
148
149 new TestCase( SECTION,
150 "Math.ceil( 1.1)",
151 2,
152 Math.ceil( 1.1));
153
154 new TestCase( SECTION,
155 "Math.ceil(Infinity)",
156 -Math.floor(-Infinity),
157 Math.ceil(Number.POSITIVE_INFINITY) );
158
159 new TestCase( SECTION,
160 "Math.ceil(-Infinity)",
161 -Math.floor(Infinity),
162 Math.ceil(Number.NEGATIVE_INFINITY) );
163
164 new TestCase( SECTION,
165 "Math.ceil(-Number.MIN_VALUE)",
166 -Math.floor(Number.MIN_VALUE),
167 Math.ceil(-Number.MIN_VALUE) );
168
169 new TestCase( SECTION,
170 "Math.ceil(1)",
171 -Math.floor(-1),
172 Math.ceil(1) );
173
174 new TestCase( SECTION,
175 "Math.ceil(-1)",
176 -Math.floor(1),
177 Math.ceil(-1) );
178
179 new TestCase( SECTION,
180 "Math.ceil(-0.9)",
181 -Math.floor(0.9),
182 Math.ceil(-0.9) );
183
184 new TestCase( SECTION,
185 "Math.ceil(0.9 )",
186 -Math.floor(-0.9),
187 Math.ceil( 0.9) );
188
189 new TestCase( SECTION,
190 "Math.ceil(-1.1)",
191 -Math.floor(1.1),
192 Math.ceil( -1.1));
193
194 new TestCase( SECTION,
195 "Math.ceil( 1.1)",
196 -Math.floor(-1.1),
197 Math.ceil( 1.1));
198
199 test();