Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/wait/bad-range.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
2 // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-atomics.wait
7 description: >
8 Test range checking of Atomics.wait on arrays that allow atomic operations
9 info: |
10 Atomics.wait( typedArray, index, value, timeout )
11
12 1. Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
13 ...
14
15 includes: [testAtomics.js]
16 features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray]
17 ---*/
18
19 const i32a = new Int32Array(
20 new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
21 );
22
23 testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
24 assert.throws(RangeError, function() {
25 Atomics.wait(i32a, IdxGen(i32a), 0, 0);
26 });
27 });
28
29 reportCompare(0, 0);