summaryrefslogtreecommitdiff
path: root/test/harness/testTypedArray.js
blob: 9c99a05a1ee086ab799590aeb3e6a480602e5e14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2017 Rick Waldron.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
    Including testTypedArray.js will expose:

        var typedArrayConstructors = [ array of TypedArray constructors ]
        var TypedArray

        testWithTypedArrayConstructors()
        testTypedArrayConversions()

includes: [testTypedArray.js,arrayContains.js]
features: [TypedArray]
---*/
var TAConstructors = [
  Float64Array,
  Float32Array,
  Int32Array,
  Int16Array,
  Int8Array,
  Uint32Array,
  Uint16Array,
  Uint8Array,
  Uint8ClampedArray
];

var length = TAConstructors.length;

assert(
  arrayContains(typedArrayConstructors, TAConstructors),
  "All TypedArray constructors are accounted for"
);
assert(typeof TypedArray === "function");
assert.sameValue(TypedArray, Object.getPrototypeOf(Uint8Array));


var callCount = 0;
testWithTypedArrayConstructors(() => callCount++);
assert.sameValue(callCount, length);