Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Atomics/add/bad-range.js

raw
1 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-atomics.add
6 description: >
7 Test range checking of Atomics.add on arrays that allow atomic operations
8 includes: [testAtomics.js, testTypedArray.js]
9 features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, let, TypedArray, for-of]
10 ---*/
11
12 var sab = new SharedArrayBuffer(8);
13 var views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array];
14
15 if (typeof BigInt !== "undefined") {
16 views.push(BigInt64Array);
17 views.push(BigUint64Array);
18 }
19
20 testWithTypedArrayConstructors(function(View) {
21 let view = new View(sab);
22 testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
23 let Idx = IdxGen(view);
24 assert.throws(RangeError, () => Atomics.add(view, Idx, 10));
25 });
26 }, views);