QML_RUNTIME_TESTING should be disabled by default.
[profile/ivi/qtdeclarative.git] / tests / auto / qml / parserstress / tests / ecma / Math / 15.8.2.13.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is Mozilla Communicator client code, released
16  * March 31, 1998.
17  *
18  * The Initial Developer of the Original Code is
19  * Netscape Communications Corporation.
20  * Portions created by the Initial Developer are Copyright (C) 1998
21  * the Initial Developer. All Rights Reserved.
22  *
23  * Contributor(s):
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39 gTestfile = '15.8.2.13.js';
40
41 /**
42    File Name:          15.8.2.13.js
43    ECMA Section:       15.8.2.13 Math.pow(x, y)
44    Description:        return an approximation to the result of x
45    to the power of y.  there are many special cases;
46    refer to the spec.
47    Author:             christine@netscape.com
48    Date:               9 july 1997
49 */
50
51 var SECTION = "15.8.2.13";
52 var VERSION = "ECMA_1";
53 var TITLE   = "Math.pow(x, y)";
54 var BUGNUMBER="77141";
55
56 startTest();
57
58 writeHeaderToLog( SECTION + " "+ TITLE);
59
60 new TestCase( SECTION,
61               "Math.pow.length",
62               2,
63               Math.pow.length );
64
65 new TestCase( SECTION,
66               "Math.pow()",
67               Number.NaN,
68               Math.pow() );
69
70 new TestCase( SECTION,
71               "Math.pow(null, null)",
72               1,
73               Math.pow(null,null) );
74
75 new TestCase( SECTION, 
76               "Math.pow(void 0, void 0)",
77               Number.NaN,
78               Math.pow(void 0, void 0));
79
80 new TestCase( SECTION, 
81               "Math.pow(true, false)",
82               1,
83               Math.pow(true, false) );
84
85 new TestCase( SECTION, 
86               "Math.pow(false,true)",
87               0,
88               Math.pow(false,true) );
89
90 new TestCase( SECTION, 
91               "Math.pow('2','32')",
92               4294967296,
93               Math.pow('2','32') );
94
95 new TestCase( SECTION, 
96               "Math.pow(1,NaN)",
97               Number.NaN,
98               Math.pow(1,Number.NaN) );
99
100 new TestCase( SECTION, 
101               "Math.pow(0,NaN)",        
102               Number.NaN,
103               Math.pow(0,Number.NaN) );
104
105 new TestCase( SECTION, 
106               "Math.pow(NaN,0)",
107               1,
108               Math.pow(Number.NaN,0) );
109
110 new TestCase( SECTION,
111               "Math.pow(NaN,-0)",
112               1,
113               Math.pow(Number.NaN,-0) );
114
115 new TestCase( SECTION, 
116               "Math.pow(NaN,1)",
117               Number.NaN,
118               Math.pow(Number.NaN, 1) );
119
120 new TestCase( SECTION, 
121               "Math.pow(NaN,.5)",
122               Number.NaN,
123               Math.pow(Number.NaN, .5) );
124
125 new TestCase( SECTION, 
126               "Math.pow(1.00000001, Infinity)",
127               Number.POSITIVE_INFINITY,
128               Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
129
130 new TestCase( SECTION, 
131               "Math.pow(1.00000001, -Infinity)", 
132               0,
133               Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
134
135 new TestCase( SECTION, 
136               "Math.pow(-1.00000001, Infinity)", 
137               Number.POSITIVE_INFINITY,
138               Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
139
140 new TestCase( SECTION, 
141               "Math.pow(-1.00000001, -Infinity)",
142               0,
143               Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
144
145 new TestCase( SECTION, 
146               "Math.pow(1, Infinity)",
147               Number.NaN,
148               Math.pow(1, Number.POSITIVE_INFINITY) );
149
150 new TestCase( SECTION, 
151               "Math.pow(1, -Infinity)",
152               Number.NaN,
153               Math.pow(1, Number.NEGATIVE_INFINITY) );
154
155 new TestCase( SECTION, 
156               "Math.pow(-1, Infinity)",
157               Number.NaN,
158               Math.pow(-1, Number.POSITIVE_INFINITY) );
159
160 new TestCase( SECTION, 
161               "Math.pow(-1, -Infinity)",
162               Number.NaN,
163               Math.pow(-1, Number.NEGATIVE_INFINITY) );
164
165 new TestCase( SECTION, 
166               "Math.pow(.0000000009, Infinity)", 
167               0,
168               Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
169
170 new TestCase( SECTION, 
171               "Math.pow(-.0000000009, Infinity)",
172               0,
173               Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
174
175 new TestCase( SECTION, 
176               "Math.pow(.0000000009, -Infinity)",
177               Number.POSITIVE_INFINITY,
178               Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
179
180 new TestCase( SECTION, 
181               "Math.pow(Infinity, .00000000001)",
182               Number.POSITIVE_INFINITY,
183               Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
184
185 new TestCase( SECTION, 
186               "Math.pow(Infinity, 1)",
187               Number.POSITIVE_INFINITY,
188               Math.pow(Number.POSITIVE_INFINITY, 1) );
189
190 new TestCase( SECTION, 
191               "Math.pow(Infinity, -.00000000001)",
192               0,
193               Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
194
195 new TestCase( SECTION, 
196               "Math.pow(Infinity, -1)",
197               0,
198               Math.pow(Number.POSITIVE_INFINITY, -1) );
199
200 new TestCase( SECTION, 
201               "Math.pow(-Infinity, 1)",
202               Number.NEGATIVE_INFINITY,
203               Math.pow(Number.NEGATIVE_INFINITY, 1) );
204
205 new TestCase( SECTION, 
206               "Math.pow(-Infinity, 333)",
207               Number.NEGATIVE_INFINITY,
208               Math.pow(Number.NEGATIVE_INFINITY, 333) );
209
210 new TestCase( SECTION, 
211               "Math.pow(Infinity, 2)",
212               Number.POSITIVE_INFINITY,
213               Math.pow(Number.POSITIVE_INFINITY, 2) );
214
215 new TestCase( SECTION, 
216               "Math.pow(-Infinity, 666)",
217               Number.POSITIVE_INFINITY,
218               Math.pow(Number.NEGATIVE_INFINITY, 666) );
219
220 new TestCase( SECTION, 
221               "Math.pow(-Infinity, 0.5)",
222               Number.POSITIVE_INFINITY,
223               Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
224
225 new TestCase( SECTION, 
226               "Math.pow(-Infinity, Infinity)",
227               Number.POSITIVE_INFINITY,
228               Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
229
230 new TestCase( SECTION, 
231               "Math.pow(-Infinity, -1)",
232               -0,
233               Math.pow(Number.NEGATIVE_INFINITY, -1) );
234
235 new TestCase( SECTION, 
236               "Infinity/Math.pow(-Infinity, -1)",
237               -Infinity,
238               Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
239
240 new TestCase( SECTION, 
241               "Math.pow(-Infinity, -3)",
242               -0,
243               Math.pow(Number.NEGATIVE_INFINITY, -3) );
244
245 new TestCase( SECTION, 
246               "Math.pow(-Infinity, -2)",
247               0,
248               Math.pow(Number.NEGATIVE_INFINITY, -2) );
249
250 new TestCase( SECTION, 
251               "Math.pow(-Infinity, -0.5)",
252               0,
253               Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
254
255 new TestCase( SECTION, 
256               "Math.pow(-Infinity, -Infinity)",
257               0,
258               Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
259
260 new TestCase( SECTION, 
261               "Math.pow(0, 1)",
262               0,
263               Math.pow(0,1) );
264
265 new TestCase( SECTION, 
266               "Math.pow(0, 0)",
267               1,
268               Math.pow(0,0) );
269
270 new TestCase( SECTION, 
271               "Math.pow(1, 0)",
272               1,
273               Math.pow(1,0) );
274
275 new TestCase( SECTION,
276               "Math.pow(-1, 0)",
277               1,
278               Math.pow(-1,0) );
279
280 new TestCase( SECTION, 
281               "Math.pow(0, 0.5)",
282               0,
283               Math.pow(0,0.5) );
284
285 new TestCase( SECTION, 
286               "Math.pow(0, 1000)",
287               0,
288               Math.pow(0,1000) );
289
290 new TestCase( SECTION,
291               "Math.pow(0, Infinity)",
292               0,
293               Math.pow(0, Number.POSITIVE_INFINITY) );
294
295 new TestCase( SECTION, 
296               "Math.pow(0, -1)",
297               Number.POSITIVE_INFINITY,
298               Math.pow(0, -1) );
299
300 new TestCase( SECTION, 
301               "Math.pow(0, -0.5)",
302               Number.POSITIVE_INFINITY,
303               Math.pow(0, -0.5) );
304
305 new TestCase( SECTION, 
306               "Math.pow(0, -1000)",
307               Number.POSITIVE_INFINITY,
308               Math.pow(0, -1000) );
309
310 new TestCase( SECTION, 
311               "Math.pow(0, -Infinity)",
312               Number.POSITIVE_INFINITY,
313               Math.pow(0, Number.NEGATIVE_INFINITY) );
314
315 new TestCase( SECTION, 
316               "Math.pow(-0, 1)",
317               -0,
318               Math.pow(-0, 1) );
319
320 new TestCase( SECTION, 
321               "Math.pow(-0, 3)",
322               -0,
323               Math.pow(-0,3) );
324
325 new TestCase( SECTION, 
326               "Infinity/Math.pow(-0, 1)",
327               -Infinity,
328               Infinity/Math.pow(-0, 1) );
329
330 new TestCase( SECTION, 
331               "Infinity/Math.pow(-0, 3)",
332               -Infinity,
333               Infinity/Math.pow(-0,3) );
334
335 new TestCase( SECTION, 
336               "Math.pow(-0, 2)",
337               0,
338               Math.pow(-0,2) );
339
340 new TestCase( SECTION, 
341               "Math.pow(-0, Infinity)",
342               0,
343               Math.pow(-0, Number.POSITIVE_INFINITY) );
344
345 new TestCase( SECTION, 
346               "Math.pow(-0, -1)",
347               Number.NEGATIVE_INFINITY,
348               Math.pow(-0, -1) );
349
350 new TestCase( SECTION, 
351               "Math.pow(-0, -10001)",
352               Number.NEGATIVE_INFINITY,
353               Math.pow(-0, -10001) );
354
355 new TestCase( SECTION, 
356               "Math.pow(-0, -2)",
357               Number.POSITIVE_INFINITY,
358               Math.pow(-0, -2) );
359
360 new TestCase( SECTION, 
361               "Math.pow(-0, 0.5)",
362               0,
363               Math.pow(-0, 0.5) );
364
365 new TestCase( SECTION, 
366               "Math.pow(-0, Infinity)",
367               0,
368               Math.pow(-0, Number.POSITIVE_INFINITY) );
369
370 new TestCase( SECTION, 
371               "Math.pow(-1, 0.5)",
372               Number.NaN,
373               Math.pow(-1, 0.5) );
374
375 new TestCase( SECTION, 
376               "Math.pow(-1, NaN)",
377               Number.NaN,
378               Math.pow(-1, Number.NaN) );
379
380 new TestCase( SECTION, 
381               "Math.pow(-1, -0.5)",
382               Number.NaN,
383               Math.pow(-1, -0.5) );
384
385 test();