test262/test/built-ins/Atomics/and/bad-range.js

23 lines
823 B
JavaScript
Raw Normal View History

// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
2017-07-26 23:49:55 +02:00
esid: sec-atomics.and
description: >
Test range checking of Atomics.and on arrays that allow atomic operations
includes: [testAtomics.js, testTypedArray.js]
features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedArrayBuffer, TypedArray]
---*/
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2);
2018-04-19 16:11:50 +02:00
var views = intArrayConstructors.slice();
2018-04-19 16:11:50 +02:00
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
2018-05-18 21:00:10 +02:00
assert.throws(RangeError, function() {
Atomics.and(view, IdxGen(view), 10);
}, 'Atomics.and(view, IdxGen(view), 10) throws RangeError');
});
}, views);