Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
7 /**
8 File Name: 15.8.2.6.js
9 ECMA Section: 15.8.2.6 Math.ceil(x)
10 Description: return the smallest number value that is not less than the
11 argument and is equal to a mathematical integer. if the
12 number is already an integer, return the number itself.
13 special cases:
14 - if x is NaN return NaN
15 - if x = +0 return +0
16 - if x = 0 return -0
17 - if x = Infinity return Infinity
18 - if x = -Infinity return -Infinity
19 - if ( -1 < x < 0 ) return -0
20 also:
21 - the value of Math.ceil(x) == -Math.ceil(-x)
22 Author: christine@netscape.com
23 Date: 7 july 1997
24 */
25 var SECTION = "15.8.2.6";
26 var VERSION = "ECMA_1";
27 startTest();
28 var TITLE = "Math.ceil(x)";
30 writeHeaderToLog( SECTION + " "+ TITLE);
32 new TestCase( SECTION,
33 "Math.ceil.length",
34 1,
35 Math.ceil.length );
37 new TestCase( SECTION,
38 "Math.ceil(NaN)",
39 Number.NaN,
40 Math.ceil(Number.NaN) );
42 new TestCase( SECTION,
43 "Math.ceil(null)",
44 0,
45 Math.ceil(null) );
47 new TestCase( SECTION,
48 "Math.ceil()",
49 Number.NaN,
50 Math.ceil() );
52 new TestCase( SECTION,
53 "Math.ceil(void 0)",
54 Number.NaN,
55 Math.ceil(void 0) );
57 new TestCase( SECTION,
58 "Math.ceil('0')",
59 0,
60 Math.ceil('0') );
62 new TestCase( SECTION,
63 "Math.ceil('-0')",
64 -0,
65 Math.ceil('-0') );
67 new TestCase( SECTION,
68 "Infinity/Math.ceil('0')",
69 Infinity,
70 Infinity/Math.ceil('0'));
72 new TestCase( SECTION,
73 "Infinity/Math.ceil('-0')",
74 -Infinity,
75 Infinity/Math.ceil('-0'));
77 new TestCase( SECTION,
78 "Math.ceil(0)",
79 0,
80 Math.ceil(0) );
82 new TestCase( SECTION,
83 "Math.ceil(-0)",
84 -0,
85 Math.ceil(-0) );
87 new TestCase( SECTION,
88 "Infinity/Math.ceil(0)",
89 Infinity,
90 Infinity/Math.ceil(0));
92 new TestCase( SECTION,
93 "Infinity/Math.ceil(-0)",
94 -Infinity,
95 Infinity/Math.ceil(-0));
98 new TestCase( SECTION,
99 "Math.ceil(Infinity)",
100 Number.POSITIVE_INFINITY,
101 Math.ceil(Number.POSITIVE_INFINITY) );
103 new TestCase( SECTION,
104 "Math.ceil(-Infinity)",
105 Number.NEGATIVE_INFINITY,
106 Math.ceil(Number.NEGATIVE_INFINITY) );
108 new TestCase( SECTION,
109 "Math.ceil(-Number.MIN_VALUE)",
110 -0,
111 Math.ceil(-Number.MIN_VALUE) );
113 new TestCase( SECTION,
114 "Infinity/Math.ceil(-Number.MIN_VALUE)",
115 -Infinity,
116 Infinity/Math.ceil(-Number.MIN_VALUE) );
118 new TestCase( SECTION,
119 "Math.ceil(1)",
120 1,
121 Math.ceil(1) );
123 new TestCase( SECTION,
124 "Math.ceil(-1)",
125 -1,
126 Math.ceil(-1) );
128 new TestCase( SECTION,
129 "Math.ceil(-0.9)",
130 -0,
131 Math.ceil(-0.9) );
133 new TestCase( SECTION,
134 "Infinity/Math.ceil(-0.9)",
135 -Infinity,
136 Infinity/Math.ceil(-0.9) );
138 new TestCase( SECTION,
139 "Math.ceil(0.9 )",
140 1,
141 Math.ceil( 0.9) );
143 new TestCase( SECTION,
144 "Math.ceil(-1.1)",
145 -1,
146 Math.ceil( -1.1));
148 new TestCase( SECTION,
149 "Math.ceil( 1.1)",
150 2,
151 Math.ceil( 1.1));
153 new TestCase( SECTION,
154 "Math.ceil(Infinity)",
155 -Math.floor(-Infinity),
156 Math.ceil(Number.POSITIVE_INFINITY) );
158 new TestCase( SECTION,
159 "Math.ceil(-Infinity)",
160 -Math.floor(Infinity),
161 Math.ceil(Number.NEGATIVE_INFINITY) );
163 new TestCase( SECTION,
164 "Math.ceil(-Number.MIN_VALUE)",
165 -Math.floor(Number.MIN_VALUE),
166 Math.ceil(-Number.MIN_VALUE) );
168 new TestCase( SECTION,
169 "Math.ceil(1)",
170 -Math.floor(-1),
171 Math.ceil(1) );
173 new TestCase( SECTION,
174 "Math.ceil(-1)",
175 -Math.floor(1),
176 Math.ceil(-1) );
178 new TestCase( SECTION,
179 "Math.ceil(-0.9)",
180 -Math.floor(0.9),
181 Math.ceil(-0.9) );
183 new TestCase( SECTION,
184 "Math.ceil(0.9 )",
185 -Math.floor(-0.9),
186 Math.ceil( 0.9) );
188 new TestCase( SECTION,
189 "Math.ceil(-1.1)",
190 -Math.floor(1.1),
191 Math.ceil( -1.1));
193 new TestCase( SECTION,
194 "Math.ceil( 1.1)",
195 -Math.floor(-1.1),
196 Math.ceil( 1.1));
198 test();