Debian Codegraph @

js/src/tests/test262/harness/testTypedArray.js

raw
1 // Copyright (c) 2017 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: >
5 Including testTypedArray.js will expose:
6
7 var typedArrayConstructors = [ array of TypedArray constructors ]
8 var TypedArray
9
10 testWithTypedArrayConstructors()
11 testTypedArrayConversions()
12
13 includes: [testTypedArray.js]
14 features: [TypedArray]
15 ---*/
16
17 assert(typeof TypedArray === "function");
18 assert.sameValue(TypedArray, Object.getPrototypeOf(Uint8Array));
19
20 var hasFloat16Array = typeof Float16Array !== 'undefined';
21
22 var callCount = 0;
23 testWithTypedArrayConstructors(() => callCount++);
24 assert.sameValue(callCount, 9 + hasFloat16Array);
25
26 var index = 0;
27
28 assert.sameValue(typedArrayConstructors[index++], Float64Array);
29 assert.sameValue(typedArrayConstructors[index++], Float32Array);
30 if (hasFloat16Array) {
31 assert.sameValue(typedArrayConstructors[index++], Float16Array);
32 }
33 assert.sameValue(typedArrayConstructors[index++], Int32Array);
34 assert.sameValue(typedArrayConstructors[index++], Int16Array);
35 assert.sameValue(typedArrayConstructors[index++], Int8Array);
36 assert.sameValue(typedArrayConstructors[index++], Uint32Array);
37 assert.sameValue(typedArrayConstructors[index++], Uint16Array);
38 assert.sameValue(typedArrayConstructors[index++], Uint8Array);
39 assert.sameValue(typedArrayConstructors[index++], Uint8ClampedArray);
40
41 reportCompare(0, 0);