summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/harness/testTypedArray-conversions.js
blob: 3af4b6a528a5fc6f04b7d5e76030b768b8786e05 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 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:

        testTypedArrayConversions()

includes: [testTypedArray.js]
features: [TypedArray]
---*/
var callCount = 0;
var bcv = {
  values: [
    127,
  ],
  expected: {
    Int8: [
      127,
    ],
    Uint8: [
      127,
    ],
    Uint8Clamped: [
      127,
    ],
    Int16: [
      127,
    ],
    Uint16: [
      127,
    ],
    Int32: [
      127,
    ],
    Uint32: [
      127,
    ],
    Float32: [
      127,
    ],
    Float64: [
      127,
    ]
  }
};

testTypedArrayConversions(bcv, function(TA, value, expected, initial) {
  var sample = new TA([initial]);
  sample.fill(value);
  assert.sameValue(initial, 0);
  assert.sameValue(sample[0], expected);
  callCount++;
});


reportCompare(0, 0);