blob: 889aef45b5c675331c2c431261fadfae202c95fe (
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
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-%typedarray%.prototype.byteoffset
description: >
Return value from [[ByteOffset]] internal slot
info: |
22.2.3.3 get %TypedArray%.prototype.byteOffset
...
6. Let offset be the value of O's [[ByteOffset]] internal slot.
7. Return size.
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
var ta1 = new TA();
assert.sameValue(ta1.byteOffset, 0, "Regular typedArray");
var offset = 4 * TA.BYTES_PER_ELEMENT;
var buffer1 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
var ta2 = new TA(buffer1, offset);
assert.sameValue(ta2.byteOffset, offset, "TA(buffer, offset)");
var buffer2 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
var sample = new TA(buffer2, offset);
var ta3 = new TA(sample);
assert.sameValue(ta3.byteOffset, 0, "TA(typedArray)");
});
reportCompare(0, 0);
|