Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / DataView / shell.js
blob2b6d995ad7bd1a6db98287ab53e2bc0ce6a1c0fd
1 // GENERATED, DO NOT EDIT
2 // file: byteConversionValues.js
3 // Copyright (C) 2016 the V8 project authors. All rights reserved.
4 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 description: |
7     Provide a list for original and expected values for different byte
8     conversions.
9     This helper is mostly used on tests for TypedArray and DataView, and each
10     array from the expected values must match the original values array on every
11     index containing its original value.
12 defines: [byteConversionValues]
13 ---*/
14 var byteConversionValues = {
15   values: [
16     127,         // 2 ** 7 - 1
17     128,         // 2 ** 7
18     32767,       // 2 ** 15 - 1
19     32768,       // 2 ** 15
20     2147483647,  // 2 ** 31 - 1
21     2147483648,  // 2 ** 31
22     255,         // 2 ** 8 - 1
23     256,         // 2 ** 8
24     65535,       // 2 ** 16 - 1
25     65536,       // 2 ** 16
26     4294967295,  // 2 ** 32 - 1
27     4294967296,  // 2 ** 32
28     9007199254740991, // 2 ** 53 - 1
29     9007199254740992, // 2 ** 53
30     1.1,
31     0.1,
32     0.5,
33     0.50000001,
34     0.6,
35     0.7,
36     undefined,
37     -1,
38     -0,
39     -0.1,
40     -1.1,
41     NaN,
42     -127,        // - ( 2 ** 7 - 1 )
43     -128,        // - ( 2 ** 7 )
44     -32767,      // - ( 2 ** 15 - 1 )
45     -32768,      // - ( 2 ** 15 )
46     -2147483647, // - ( 2 ** 31 - 1 )
47     -2147483648, // - ( 2 ** 31 )
48     -255,        // - ( 2 ** 8 - 1 )
49     -256,        // - ( 2 ** 8 )
50     -65535,      // - ( 2 ** 16 - 1 )
51     -65536,      // - ( 2 ** 16 )
52     -4294967295, // - ( 2 ** 32 - 1 )
53     -4294967296, // - ( 2 ** 32 )
54     Infinity,
55     -Infinity,
56     0,
57     2049,                         // an integer which rounds down under ties-to-even when cast to float16
58     2051,                         // an integer which rounds up under ties-to-even when cast to float16
59     0.00006103515625,             // smallest normal float16
60     0.00006097555160522461,       // largest subnormal float16
61     5.960464477539063e-8,         // smallest float16
62     2.9802322387695312e-8,        // largest double which rounds to 0 when cast to float16
63     2.980232238769532e-8,         // smallest double which does not round to 0 when cast to float16
64     8.940696716308594e-8,         // a double which rounds up to a subnormal under ties-to-even when cast to float16
65     1.4901161193847656e-7,        // a double which rounds down to a subnormal under ties-to-even when cast to float16
66     1.490116119384766e-7,         // the next double above the one on the previous line one
67     65504,                        // max finite float16
68     65520,                        // smallest double which rounds to infinity when cast to float16
69     65519.99999999999,            // largest double which does not round to infinity when cast to float16
70     0.000061005353927612305,      // smallest double which rounds to a non-subnormal when cast to float16
71     0.0000610053539276123         // largest double which rounds to a subnormal when cast to float16
72   ],
74   expected: {
75     Int8: [
76       127,  // 127
77       -128, // 128
78       -1,   // 32767
79       0,    // 32768
80       -1,   // 2147483647
81       0,    // 2147483648
82       -1,   // 255
83       0,    // 256
84       -1,   // 65535
85       0,    // 65536
86       -1,   // 4294967295
87       0,    // 4294967296
88       -1,   // 9007199254740991
89       0,    // 9007199254740992
90       1,    // 1.1
91       0,    // 0.1
92       0,    // 0.5
93       0,    // 0.50000001,
94       0,    // 0.6
95       0,    // 0.7
96       0,    // undefined
97       -1,   // -1
98       0,    // -0
99       0,    // -0.1
100       -1,   // -1.1
101       0,    // NaN
102       -127, // -127
103       -128, // -128
104       1,    // -32767
105       0,    // -32768
106       1,    // -2147483647
107       0,    // -2147483648
108       1,    // -255
109       0,    // -256
110       1,    // -65535
111       0,    // -65536
112       1,    // -4294967295
113       0,    // -4294967296
114       0,    // Infinity
115       0,    // -Infinity
116       0,    // 0
117       1,    // 2049
118       3,    // 2051
119       0,    // 0.00006103515625
120       0,    // 0.00006097555160522461
121       0,    // 5.960464477539063e-8
122       0,    // 2.9802322387695312e-8
123       0,    // 2.980232238769532e-8
124       0,    // 8.940696716308594e-8
125       0,    // 1.4901161193847656e-7
126       0,    // 1.490116119384766e-7
127       -32,  // 65504
128       -16,  // 65520
129       -17,  // 65519.99999999999
130       0,    // 0.000061005353927612305
131       0     // 0.0000610053539276123
132     ],
133     Uint8: [
134       127, // 127
135       128, // 128
136       255, // 32767
137       0,   // 32768
138       255, // 2147483647
139       0,   // 2147483648
140       255, // 255
141       0,   // 256
142       255, // 65535
143       0,   // 65536
144       255, // 4294967295
145       0,   // 4294967296
146       255, // 9007199254740991
147       0,   // 9007199254740992
148       1,   // 1.1
149       0,   // 0.1
150       0,   // 0.5
151       0,   // 0.50000001,
152       0,   // 0.6
153       0,   // 0.7
154       0,   // undefined
155       255, // -1
156       0,   // -0
157       0,   // -0.1
158       255, // -1.1
159       0,   // NaN
160       129, // -127
161       128, // -128
162       1,   // -32767
163       0,   // -32768
164       1,   // -2147483647
165       0,   // -2147483648
166       1,   // -255
167       0,   // -256
168       1,   // -65535
169       0,   // -65536
170       1,   // -4294967295
171       0,   // -4294967296
172       0,   // Infinity
173       0,   // -Infinity
174       0,   // 0
175       1,   // 2049
176       3,   // 2051
177       0,   // 0.00006103515625
178       0,   // 0.00006097555160522461
179       0,   // 5.960464477539063e-8
180       0,   // 2.9802322387695312e-8
181       0,   // 2.980232238769532e-8
182       0,   // 8.940696716308594e-8
183       0,   // 1.4901161193847656e-7
184       0,   // 1.490116119384766e-7
185       224, // 65504
186       240, // 65520
187       239, // 65519.99999999999
188       0,   // 0.000061005353927612305
189       0    // 0.0000610053539276123
190     ],
191     Uint8Clamped: [
192       127, // 127
193       128, // 128
194       255, // 32767
195       255, // 32768
196       255, // 2147483647
197       255, // 2147483648
198       255, // 255
199       255, // 256
200       255, // 65535
201       255, // 65536
202       255, // 4294967295
203       255, // 4294967296
204       255, // 9007199254740991
205       255, // 9007199254740992
206       1,   // 1.1,
207       0,   // 0.1
208       0,   // 0.5
209       1,   // 0.50000001,
210       1,   // 0.6
211       1,   // 0.7
212       0,   // undefined
213       0,   // -1
214       0,   // -0
215       0,   // -0.1
216       0,   // -1.1
217       0,   // NaN
218       0,   // -127
219       0,   // -128
220       0,   // -32767
221       0,   // -32768
222       0,   // -2147483647
223       0,   // -2147483648
224       0,   // -255
225       0,   // -256
226       0,   // -65535
227       0,   // -65536
228       0,   // -4294967295
229       0,   // -4294967296
230       255, // Infinity
231       0,   // -Infinity
232       0,   // 0
233       255, // 2049
234       255, // 2051
235       0,   // 0.00006103515625
236       0,   // 0.00006097555160522461
237       0,   // 5.960464477539063e-8
238       0,   // 2.9802322387695312e-8
239       0,   // 2.980232238769532e-8
240       0,   // 8.940696716308594e-8
241       0,   // 1.4901161193847656e-7
242       0,   // 1.490116119384766e-7
243       255, // 65504
244       255, // 65520
245       255, // 65519.99999999999
246       0,   // 0.000061005353927612305
247       0    // 0.0000610053539276123
248     ],
249     Int16: [
250       127,    // 127
251       128,    // 128
252       32767,  // 32767
253       -32768, // 32768
254       -1,     // 2147483647
255       0,      // 2147483648
256       255,    // 255
257       256,    // 256
258       -1,     // 65535
259       0,      // 65536
260       -1,     // 4294967295
261       0,      // 4294967296
262       -1,     // 9007199254740991
263       0,      // 9007199254740992
264       1,      // 1.1
265       0,      // 0.1
266       0,      // 0.5
267       0,      // 0.50000001,
268       0,      // 0.6
269       0,      // 0.7
270       0,      // undefined
271       -1,     // -1
272       0,      // -0
273       0,      // -0.1
274       -1,     // -1.1
275       0,      // NaN
276       -127,   // -127
277       -128,   // -128
278       -32767, // -32767
279       -32768, // -32768
280       1,      // -2147483647
281       0,      // -2147483648
282       -255,   // -255
283       -256,   // -256
284       1,      // -65535
285       0,      // -65536
286       1,      // -4294967295
287       0,      // -4294967296
288       0,      // Infinity
289       0,      // -Infinity
290       0,      // 0
291       2049,   // 2049
292       2051,   // 2051
293       0,      // 0.00006103515625
294       0,      // 0.00006097555160522461
295       0,      // 5.960464477539063e-8
296       0,      // 2.9802322387695312e-8
297       0,      // 2.980232238769532e-8
298       0,      // 8.940696716308594e-8
299       0,      // 1.4901161193847656e-7
300       0,      // 1.490116119384766e-7
301       -32,    // 65504
302       -16,    // 65520
303       -17,    // 65519.99999999999
304       0,      // 0.000061005353927612305
305       0       // 0.0000610053539276123
306     ],
307     Uint16: [
308       127,   // 127
309       128,   // 128
310       32767, // 32767
311       32768, // 32768
312       65535, // 2147483647
313       0,     // 2147483648
314       255,   // 255
315       256,   // 256
316       65535, // 65535
317       0,     // 65536
318       65535, // 4294967295
319       0,     // 4294967296
320       65535, // 9007199254740991
321       0,     // 9007199254740992
322       1,     // 1.1
323       0,     // 0.1
324       0,     // 0.5
325       0,     // 0.50000001,
326       0,     // 0.6
327       0,     // 0.7
328       0,     // undefined
329       65535, // -1
330       0,     // -0
331       0,     // -0.1
332       65535, // -1.1
333       0,     // NaN
334       65409, // -127
335       65408, // -128
336       32769, // -32767
337       32768, // -32768
338       1,     // -2147483647
339       0,     // -2147483648
340       65281, // -255
341       65280, // -256
342       1,     // -65535
343       0,     // -65536
344       1,     // -4294967295
345       0,     // -4294967296
346       0,     // Infinity
347       0,     // -Infinity
348       0,     // 0
349       2049,  // 2049
350       2051,  // 2051
351       0,     // 0.00006103515625
352       0,     // 0.00006097555160522461
353       0,     // 5.960464477539063e-8
354       0,     // 2.9802322387695312e-8
355       0,     // 2.980232238769532e-8
356       0,     // 8.940696716308594e-8
357       0,     // 1.4901161193847656e-7
358       0,     // 1.490116119384766e-7
359       65504, // 65504
360       65520, // 65520
361       65519, // 65519.99999999999
362       0,     // 0.000061005353927612305
363       0      // 0.0000610053539276123
364     ],
365     Int32: [
366       127,         // 127
367       128,         // 128
368       32767,       // 32767
369       32768,       // 32768
370       2147483647,  // 2147483647
371       -2147483648, // 2147483648
372       255,         // 255
373       256,         // 256
374       65535,       // 65535
375       65536,       // 65536
376       -1,          // 4294967295
377       0,           // 4294967296
378       -1,          // 9007199254740991
379       0,           // 9007199254740992
380       1,           // 1.1
381       0,           // 0.1
382       0,           // 0.5
383       0,           // 0.50000001,
384       0,           // 0.6
385       0,           // 0.7
386       0,           // undefined
387       -1,          // -1
388       0,           // -0
389       0,           // -0.1
390       -1,          // -1.1
391       0,           // NaN
392       -127,        // -127
393       -128,        // -128
394       -32767,      // -32767
395       -32768,      // -32768
396       -2147483647, // -2147483647
397       -2147483648, // -2147483648
398       -255,        // -255
399       -256,        // -256
400       -65535,      // -65535
401       -65536,      // -65536
402       1,           // -4294967295
403       0,           // -4294967296
404       0,           // Infinity
405       0,           // -Infinity
406       0,           // 0
407       2049,        // 2049
408       2051,        // 2051
409       0,           // 0.00006103515625
410       0,           // 0.00006097555160522461
411       0,           // 5.960464477539063e-8
412       0,           // 2.9802322387695312e-8
413       0,           // 2.980232238769532e-8
414       0,           // 8.940696716308594e-8
415       0,           // 1.4901161193847656e-7
416       0,           // 1.490116119384766e-7
417       65504,       // 65504
418       65520,       // 65520
419       65519,       // 65519.99999999999
420       0,           // 0.000061005353927612305
421       0            // 0.0000610053539276123
422     ],
423     Uint32: [
424       127,        // 127
425       128,        // 128
426       32767,      // 32767
427       32768,      // 32768
428       2147483647, // 2147483647
429       2147483648, // 2147483648
430       255,        // 255
431       256,        // 256
432       65535,      // 65535
433       65536,      // 65536
434       4294967295, // 4294967295
435       0,          // 4294967296
436       4294967295, // 9007199254740991
437       0,          // 9007199254740992
438       1,          // 1.1
439       0,          // 0.1
440       0,          // 0.5
441       0,          // 0.50000001,
442       0,          // 0.6
443       0,          // 0.7
444       0,          // undefined
445       4294967295, // -1
446       0,          // -0
447       0,          // -0.1
448       4294967295, // -1.1
449       0,          // NaN
450       4294967169, // -127
451       4294967168, // -128
452       4294934529, // -32767
453       4294934528, // -32768
454       2147483649, // -2147483647
455       2147483648, // -2147483648
456       4294967041, // -255
457       4294967040, // -256
458       4294901761, // -65535
459       4294901760, // -65536
460       1,          // -4294967295
461       0,          // -4294967296
462       0,          // Infinity
463       0,          // -Infinity
464       0,          // 0
465       2049,       // 2049
466       2051,       // 2051
467       0,          // 0.00006103515625
468       0,          // 0.00006097555160522461
469       0,          // 5.960464477539063e-8
470       0,          // 2.9802322387695312e-8
471       0,          // 2.980232238769532e-8
472       0,          // 8.940696716308594e-8
473       0,          // 1.4901161193847656e-7
474       0,          // 1.490116119384766e-7
475       65504,      // 65504
476       65520,      // 65520
477       65519,      // 65519.99999999999
478       0,          // 0.000061005353927612305
479       0           // 0.0000610053539276123
480     ],
481     Float16: [
482       127,                    // 127
483       128,                    // 128
484       32768,                  // 32767
485       32768,                  // 32768
486       Infinity,               // 2147483647
487       Infinity,               // 2147483648
488       255,                    // 255
489       256,                    // 256
490       Infinity,               // 65535
491       Infinity,               // 65536
492       Infinity,               // 4294967295
493       Infinity,               // 4294967296
494       Infinity,               // 9007199254740991
495       Infinity,               // 9007199254740992
496       1.099609375,            // 1.1
497       0.0999755859375,        // 0.1
498       0.5,                    // 0.5
499       0.5,                    // 0.50000001,
500       0.60009765625,          // 0.6
501       0.7001953125,           // 0.7
502       NaN,                    // undefined
503       -1,                     // -1
504       -0,                     // -0
505       -0.0999755859375,       // -0.1
506       -1.099609375,           // -1.1
507       NaN,                    // NaN
508       -127,                   // -127
509       -128,                   // -128
510       -32768,                 // -32767
511       -32768,                 // -32768
512       -Infinity,              // -2147483647
513       -Infinity,              // -2147483648
514       -255,                   // -255
515       -256,                   // -256
516       -Infinity,              // -65535
517       -Infinity,              // -65536
518       -Infinity,              // -4294967295
519       -Infinity,              // -4294967296
520       Infinity,               // Infinity
521       -Infinity,              // -Infinity
522       0,                      // 0
523       2048,                   // 2049
524       2052,                   // 2051
525       0.00006103515625,       // 0.00006103515625
526       0.00006097555160522461, // 0.00006097555160522461
527       5.960464477539063e-8,   // 5.960464477539063e-8
528       0,                      // 2.9802322387695312e-8
529       5.960464477539063e-8,   // 2.980232238769532e-8
530       1.1920928955078125e-7,  // 8.940696716308594e-8
531       1.1920928955078125e-7,  // 1.4901161193847656e-7
532       1.7881393432617188e-7,  // 1.490116119384766e-7
533       65504,                  // 65504
534       Infinity,               // 65520
535       65504,                  // 65519.99999999999
536       0.00006103515625,       // 0.000061005353927612305
537       0.00006097555160522461  // 0.0000610053539276123
538     ],
539     Float32: [
540       127,                     // 127
541       128,                     // 128
542       32767,                   // 32767
543       32768,                   // 32768
544       2147483648,              // 2147483647
545       2147483648,              // 2147483648
546       255,                     // 255
547       256,                     // 256
548       65535,                   // 65535
549       65536,                   // 65536
550       4294967296,              // 4294967295
551       4294967296,              // 4294967296
552       9007199254740992,        // 9007199254740991
553       9007199254740992,        // 9007199254740992
554       1.100000023841858,       // 1.1
555       0.10000000149011612,     // 0.1
556       0.5,                     // 0.5
557       0.5,                     // 0.50000001,
558       0.6000000238418579,      // 0.6
559       0.699999988079071,       // 0.7
560       NaN,                     // undefined
561       -1,                      // -1
562       -0,                      // -0
563       -0.10000000149011612,    // -0.1
564       -1.100000023841858,      // -1.1
565       NaN,                     // NaN
566       -127,                    // -127
567       -128,                    // -128
568       -32767,                  // -32767
569       -32768,                  // -32768
570       -2147483648,             // -2147483647
571       -2147483648,             // -2147483648
572       -255,                    // -255
573       -256,                    // -256
574       -65535,                  // -65535
575       -65536,                  // -65536
576       -4294967296,             // -4294967295
577       -4294967296,             // -4294967296
578       Infinity,                // Infinity
579       -Infinity,               // -Infinity
580       0,                       // 0
581       2049,                    // 2049
582       2051,                    // 2051
583       0.00006103515625,        // 0.00006103515625
584       0.00006097555160522461,  // 0.00006097555160522461
585       5.960464477539063e-8,    // 5.960464477539063e-8
586       2.9802322387695312e-8,   // 2.9802322387695312e-8
587       2.9802322387695312e-8,   // 2.980232238769532e-8
588       8.940696716308594e-8,    // 8.940696716308594e-8
589       1.4901161193847656e-7,   // 1.4901161193847656e-7
590       1.4901161193847656e-7,   // 1.490116119384766e-7
591       65504,                   // 65504
592       65520,                   // 65520
593       65520,                   // 65519.99999999999
594       0.000061005353927612305, // 0.000061005353927612305
595       0.000061005353927612305  // 0.0000610053539276123
596     ],
597     Float64: [
598       127,         // 127
599       128,         // 128
600       32767,       // 32767
601       32768,       // 32768
602       2147483647,  // 2147483647
603       2147483648,  // 2147483648
604       255,         // 255
605       256,         // 256
606       65535,       // 65535
607       65536,       // 65536
608       4294967295,  // 4294967295
609       4294967296,  // 4294967296
610       9007199254740991, // 9007199254740991
611       9007199254740992, // 9007199254740992
612       1.1,         // 1.1
613       0.1,         // 0.1
614       0.5,         // 0.5
615       0.50000001,  // 0.50000001,
616       0.6,         // 0.6
617       0.7,         // 0.7
618       NaN,         // undefined
619       -1,          // -1
620       -0,          // -0
621       -0.1,        // -0.1
622       -1.1,        // -1.1
623       NaN,         // NaN
624       -127,        // -127
625       -128,        // -128
626       -32767,      // -32767
627       -32768,      // -32768
628       -2147483647, // -2147483647
629       -2147483648, // -2147483648
630       -255,        // -255
631       -256,        // -256
632       -65535,      // -65535
633       -65536,      // -65536
634       -4294967295, // -4294967295
635       -4294967296, // -4294967296
636       Infinity,    // Infinity
637       -Infinity,   // -Infinity
638       0,           // 0
639       2049,                    // 2049
640       2051,                    // 2051
641       0.00006103515625,        // 0.00006103515625
642       0.00006097555160522461,  // 0.00006097555160522461
643       5.960464477539063e-8,    // 5.960464477539063e-8
644       2.9802322387695312e-8,   // 2.9802322387695312e-8
645       2.980232238769532e-8,    // 2.980232238769532e-8
646       8.940696716308594e-8,    // 8.940696716308594e-8
647       1.4901161193847656e-7,   // 1.4901161193847656e-7
648       1.490116119384766e-7,    // 1.490116119384766e-7
649       65504,                   // 65504
650       65520,                   // 65520
651       65519.99999999999,       // 65519.99999999999
652       0.000061005353927612305, // 0.000061005353927612305
653       0.0000610053539276123    // 0.0000610053539276123
654     ]
655   }
658 // file: detachArrayBuffer.js
659 // Copyright (C) 2016 the V8 project authors.  All rights reserved.
660 // This code is governed by the BSD license found in the LICENSE file.
661 /*---
662 description: |
663     A function used in the process of asserting correctness of TypedArray objects.
665     $262.detachArrayBuffer is defined by a host.
666 defines: [$DETACHBUFFER]
667 ---*/
669 function $DETACHBUFFER(buffer) {
670   if (!$262 || typeof $262.detachArrayBuffer !== "function") {
671     throw new Test262Error("No method available to detach an ArrayBuffer");
672   }
673   $262.detachArrayBuffer(buffer);
676 // file: isConstructor.js
677 // Copyright (C) 2017 AndrĂ© Bargull. All rights reserved.
678 // This code is governed by the BSD license found in the LICENSE file.
680 /*---
681 description: |
682     Test if a given function is a constructor function.
683 defines: [isConstructor]
684 features: [Reflect.construct]
685 ---*/
687 function isConstructor(f) {
688     if (typeof f !== "function") {
689       throw new Test262Error("isConstructor invoked with a non-function value");
690     }
692     try {
693         Reflect.construct(function(){}, [], f);
694     } catch (e) {
695         return false;
696     }
697     return true;