2017-02-07 17:17:31 +01:00
|
|
|
// 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.sub
|
2017-02-07 17:17:31 +01:00
|
|
|
description: >
|
|
|
|
Test range checking of Atomics.sub on arrays that allow atomic operations
|
|
|
|
includes: [testAtomics.js, testTypedArray.js]
|
2018-04-25 17:33:53 +02:00
|
|
|
features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedArrayBuffer, TypedArray]
|
2017-02-07 17:17:31 +01:00
|
|
|
---*/
|
|
|
|
|
2018-06-26 21:01:53 +02:00
|
|
|
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2);
|
2018-04-19 16:11:50 +02:00
|
|
|
var views = intArrayConstructors.slice();
|
2017-02-07 17:17:31 +01:00
|
|
|
|
2018-04-19 16:11:50 +02:00
|
|
|
testWithTypedArrayConstructors(function(TA) {
|
|
|
|
let view = new TA(buffer);
|
2018-02-15 21:26:13 +01:00
|
|
|
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
2018-05-18 21:00:10 +02:00
|
|
|
assert.throws(RangeError, function() {
|
|
|
|
Atomics.sub(view, IdxGen(view), 10);
|
2018-06-27 18:58:02 +02:00
|
|
|
}, '`Atomics.sub(view, IdxGen(view), 10)` throws RangeError');
|
2018-02-15 21:26:13 +01:00
|
|
|
});
|
2017-02-07 17:17:31 +01:00
|
|
|
}, views);
|