Atomics: use regular functions

This commit is contained in:
Rick Waldron 2018-05-18 15:00:10 -04:00
parent a19232ca4c
commit 7389389071
62 changed files with 195 additions and 161 deletions

View File

@ -15,10 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.add(view, IdxGen(view), 10),
'Atomics.add(view, IdxGen(view), 10) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.add(view, IdxGen(view), 10);
}, 'Atomics.add(view, IdxGen(view), 10) throws RangeError');
});
}, views);

View File

@ -14,10 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.add(view, IdxGen(view), 10),
'Atomics.add(view, IdxGen(view), 10) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.add(view, IdxGen(view), 10);
}, 'Atomics.add(view, IdxGen(view), 10) throws RangeError');
});
});

View File

@ -12,9 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var ab = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.add(new TA(ab), 0, 0),
'Atomics.add(new TA(ab), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.add(new TA(ab), 0, 0);
}, 'Atomics.add(new TA(ab), 0, 0) throws TypeError');
});

View File

@ -10,9 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(
TypeError,
() => Atomics.add(view, 0, 0),
'Atomics.add(view, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.add(view, 0, 0);
}, 'Atomics.add(view, 0, 0) throws TypeError');
});

View File

@ -13,9 +13,7 @@ var ab = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.add(new TA(ab), 0, 0),
'Atomics.add(new TA(ab), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.add(new TA(ab), 0, 0);
}, 'Atomics.add(new TA(ab), 0, 0) throws TypeError');
}, views);

View File

@ -12,9 +12,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.add(new TA(buffer), 0, 0),
'Atomics.add(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.add(new TA(buffer), 0, 0);
}, 'Atomics.add(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,10 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.and(view, IdxGen(view), 10),
'Atomics.and(view, IdxGen(view), 10) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.and(view, IdxGen(view), 10);
}, 'Atomics.and(view, IdxGen(view), 10) throws RangeError');
});
}, views);

View File

@ -14,10 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.and(view, IdxGen(view), 10),
'Atomics.and(view, IdxGen(view), 10) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.and(view, IdxGen(view), 10);
}, 'Atomics.and(view, IdxGen(view), 10) throws RangeError');
});
});

View File

@ -12,9 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.and(new TA(buffer), 0, 0),
'Atomics.and(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.and(new TA(buffer), 0, 0);
}, 'Atomics.and(new TA(buffer), 0, 0) throws TypeError');
});

View File

@ -10,9 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(
TypeError,
() => Atomics.and(view, 0, 0),
'Atomics.and(view, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.and(view, 0, 0);
}, 'Atomics.and(view, 0, 0) throws TypeError');
});

View File

@ -13,9 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.and(new TA(buffer), 0, 0),
'Atomics.and(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.and(new TA(buffer), 0, 0);
}, 'Atomics.and(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,9 +12,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.and(new TA(buffer), 0, 0),
'Atomics.and(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.and(new TA(buffer), 0, 0);
}, 'Atomics.and(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,10 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.compareExchange(view, IdxGen(view), 10, 0),
'Atomics.compareExchange(view, IdxGen(view), 10, 0) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.compareExchange(view, IdxGen(view), 10, 0);
}, 'Atomics.compareExchange(view, IdxGen(view), 10, 0) throws RangeError');
});
}, views);

View File

@ -14,10 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.compareExchange(view, IdxGen(view), 10, 0),
'Atomics.compareExchange(view, IdxGen(view), 10, 0) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.compareExchange(view, IdxGen(view), 10, 0);
}, 'Atomics.compareExchange(view, IdxGen(view), 10, 0) throws RangeError');
});
});

View File

@ -12,9 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.compareExchange(new TA(buffer), 0, 0, 0),
'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.compareExchange(new TA(buffer), 0, 0, 0);
}, 'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError');
});

View File

@ -10,9 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(
TypeError,
() => Atomics.compareExchange(view, 0, 0, 0),
'Atomics.compareExchange(view, 0, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.compareExchange(view, 0, 0, 0);
}, 'Atomics.compareExchange(view, 0, 0, 0) throws TypeError');
});

View File

@ -13,9 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.compareExchange(new TA(buffer), 0, 0, 0),
'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.compareExchange(new TA(buffer), 0, 0, 0);
}, 'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError');
}, views);

View File

@ -12,9 +12,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.compareExchange(new TA(buffer), 0, 0, 0),
'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.compareExchange(new TA(buffer), 0, 0, 0);
}, 'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,10 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.exchange(view, IdxGen(view), 10, 0),
'Atomics.exchange(view, IdxGen(view), 10, 0) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.exchange(view, IdxGen(view), 10, 0);
}, 'Atomics.exchange(view, IdxGen(view), 10, 0) throws RangeError');
});
}, views);

View File

@ -14,10 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(
RangeError,
() => Atomics.exchange(view, IdxGen(view), 10, 0),
'Atomics.exchange(view, IdxGen(view), 10, 0) throws RangeError'
);
assert.throws(RangeError, function() {
Atomics.exchange(view, IdxGen(view), 10, 0);
}, 'Atomics.exchange(view, IdxGen(view), 10, 0) throws RangeError');
});
});

View File

@ -12,9 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.exchange(new TA(buffer), 0, 0),
'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.exchange(new TA(buffer), 0, 0);
}, 'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError');
});

View File

@ -10,9 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(
TypeError,
() => Atomics.exchange(view, 0, 0),
'Atomics.exchange(view, 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.exchange(view, 0, 0);
}, 'Atomics.exchange(view, 0, 0) throws TypeError');
});

View File

@ -13,9 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.exchange(new TA(buffer), 0, 0),
'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.exchange(new TA(buffer), 0, 0);
}, 'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,9 +12,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(
TypeError,
() => Atomics.exchange(new TA(buffer), 0, 0),
'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError'
);
assert.throws(TypeError, function() {
Atomics.exchange(new TA(buffer), 0, 0);
}, 'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,6 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.load(view, IdxGen(view)));
assert.throws(RangeError, function() {
Atomics.load(view, IdxGen(view));
}, 'Atomics.load(view, IdxGen(view)) throws RangeError');
});
}, views);

View File

@ -14,6 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.load(view, IdxGen(view)));
assert.throws(RangeError, function() {
Atomics.load(view, IdxGen(view));
}, 'Atomics.load(view, IdxGen(view)) throws RangeError');
});
});

View File

@ -15,5 +15,7 @@ var ab = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
var view = new TA(ab);
assert.throws(TypeError, (() => Atomics.load(view, 0)));
assert.throws(TypeError, function() {
Atomics.load(view, 0);
}, 'Atomics.load(view, 0) throws TypeError');
});

View File

@ -10,5 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(TypeError, (() => Atomics.load(view, 0)));
assert.throws(TypeError, function() {
Atomics.load(view, 0);
}, 'Atomics.load(view, 0) throws TypeError');
});

View File

@ -16,5 +16,7 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
var view = new TA(ab);
assert.throws(TypeError, (() => Atomics.load(view, 0)));
assert.throws(TypeError, function() {
Atomics.load(view, 0);
}, 'Atomics.load(view, 0) throws TypeError');
}, views);

View File

@ -11,5 +11,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.load(new TA(buffer), 0)));
assert.throws(TypeError, function() {
Atomics.load(new TA(buffer), 0);
}, 'Atomics.load(new TA(buffer), 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,6 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.or(view, IdxGen(view), 10));
assert.throws(RangeError, function() {
Atomics.or(view, IdxGen(view), 10);
}, 'Atomics.or(view, IdxGen(view), 10) throws RangeError');
});
}, views);

View File

@ -14,6 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.or(view, IdxGen(view), 10));
assert.throws(RangeError, function() {
Atomics.or(view, IdxGen(view), 10);
}, 'Atomics.or(view, IdxGen(view), 10) throws RangeError');
});
});

View File

@ -12,5 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.or(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.or(new TA(buffer), 0, 0);
}, 'Atomics.or(new TA(buffer), 0, 0) throws TypeError');
});

View File

@ -10,5 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(TypeError, (() => Atomics.or(view, 0, 0)));
assert.throws(TypeError, function() {
Atomics.or(view, 0, 0);
}, 'Atomics.or(view, 0, 0) throws TypeError');
});

View File

@ -13,5 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.or(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.or(new TA(buffer), 0, 0);
}, 'Atomics.or(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,7 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.or(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.or(new TA(buffer), 0, 0);
}, 'Atomics.or(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,6 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.store(view, IdxGen(view), 10));
assert.throws(RangeError, function() {
Atomics.store(view, IdxGen(view), 10);
}, 'Atomics.store(view, IdxGen(view), 10) throws RangeError');
});
}, views);

View File

@ -14,6 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.store(view, IdxGen(view), 10));
assert.throws(RangeError, function() {
Atomics.store(view, IdxGen(view), 10);
}, 'Atomics.store(view, IdxGen(view), 10) throws RangeError');
});
});

View File

@ -12,5 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.store(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.store(new TA(buffer), 0, 0);
}, 'Atomics.store(new TA(buffer), 0, 0) throws TypeError');
});

View File

@ -10,5 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(TypeError, (() => Atomics.store(view, 0, 0)));
assert.throws(TypeError, function() {
Atomics.store(view, 0, 0);
}, 'Atomics.store(view, 0, 0) throws TypeError');
});

View File

@ -13,5 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.store(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.store(new TA(buffer), 0, 0);
}, 'Atomics.store(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,7 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.store(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.store(new TA(buffer), 0, 0);
}, 'Atomics.store(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,6 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.sub(view, IdxGen(view), 10));
assert.throws(RangeError, function() {
Atomics.sub(view, IdxGen(view), 10);
}, 'Atomics.sub(view, IdxGen(view), 10) throws RangeError');
});
}, views);

View File

@ -14,6 +14,8 @@ var buffer = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(buffer);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.sub(view, IdxGen(view), 10));
assert.throws(RangeError, function() {
Atomics.sub(view, IdxGen(view), 10);
}, 'Atomics.sub(view, IdxGen(view), 10) throws RangeError');
});
});

View File

@ -12,5 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.sub(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.sub(new TA(buffer), 0, 0);
}, 'Atomics.sub(new TA(buffer), 0, 0) throws TypeError');
});

View File

@ -10,5 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(TypeError, (() => Atomics.sub(view, 0, 0)));
assert.throws(TypeError, function() {
Atomics.sub(view, 0, 0);
}, 'Atomics.sub(view, 0, 0) throws TypeError');
});

View File

@ -13,5 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.sub(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.sub(new TA(buffer), 0, 0);
}, 'Atomics.sub(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,7 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.sub(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.sub(new TA(buffer), 0, 0);
}, 'Atomics.sub(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -19,5 +19,7 @@ var sab = new SharedArrayBuffer(8);
let i32a = new Int32Array(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.wait(i32a, IdxGen(i32a), 0, 0));
assert.throws(RangeError, function() {
Atomics.wait(i32a, IdxGen(i32a), 0, 0);
}, 'Atomics.wait(i32a, IdxGen(i32a), 0, 0) throws RangeError');
});

View File

@ -19,5 +19,7 @@ var sab = new SharedArrayBuffer(8);
let i64a = new BigInt64Array(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.wait(i64a, IdxGen(i64a), 0, 0));
assert.throws(RangeError, function() {
Atomics.wait(i64a, IdxGen(i64a), 0, 0);
}, 'Atomics.wait(i64a, IdxGen(i64a), 0, 0) throws RangeError');
});

View File

@ -21,6 +21,8 @@ var views = [Int32Array];
testWithTypedArrayConstructors(function(TA) {
let view = new TA(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.wake(view, IdxGen(view), 0)); // Even with waking zero
assert.throws(RangeError, function() {
Atomics.wake(view, IdxGen(view), 0);
}, 'Atomics.wake(view, IdxGen(view), 0) throws RangeError'); // Even with waking zero
});
}, views);

View File

@ -19,5 +19,7 @@ var sab = new SharedArrayBuffer(8);
let i64a = new BigInt64Array(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.wake(view, IdxGen(i64a), 0));
assert.throws(RangeError, function() {
Atomics.wake(view, IdxGen(i64a), 0);
}, 'Atomics.wake(view, IdxGen(i64a), 0) throws RangeError');
});

View File

@ -24,7 +24,15 @@ var poisoned = {
}
};
assert.throws(RangeError, () => Atomics.wake(i32a, -Infinity, poisoned));
assert.throws(RangeError, () => Atomics.wake(i32a, -7.999, poisoned));
assert.throws(RangeError, () => Atomics.wake(i32a, -1, poisoned));
assert.throws(RangeError, () => Atomics.wake(i32a, -300, poisoned));
assert.throws(RangeError, function() {
Atomics.wake(i32a, -Infinity, poisoned);
}, 'Atomics.wake(i32a, -Infinity, poisoned) throws RangeError');
assert.throws(RangeError, function() {
Atomics.wake(i32a, -7.999, poisoned);
}, 'Atomics.wake(i32a, -7.999, poisoned) throws RangeError');
assert.throws(RangeError, function() {
Atomics.wake(i32a, -1, poisoned);
}, 'Atomics.wake(i32a, -1, poisoned) throws RangeError');
assert.throws(RangeError, function() {
Atomics.wake(i32a, -300, poisoned);
}, 'Atomics.wake(i32a, -300, poisoned) throws RangeError');

View File

@ -10,5 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(TypeError, (() => Atomics.wake(view, 0, 0))); // Even with count == 0
assert.throws(TypeError, function() {
Atomics.wake(view, 0, 0);
}, 'Atomics.wake(view, 0, 0) throws TypeError'); // Even with count == 0
});

View File

@ -14,5 +14,7 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
// Should fail even if waking zero waiters
assert.throws(TypeError, (() => Atomics.wake(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.wake(new TA(buffer), 0, 0);
}, 'Atomics.wake(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,7 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.wake(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.wake(new TA(buffer), 0, 0);
}, 'Atomics.wake(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);

View File

@ -15,6 +15,8 @@ var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
let view = new TA(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.xor(view, IdxGen(view), 0));
assert.throws(RangeError, function() {
Atomics.xor(view, IdxGen(view), 0);
}, 'Atomics.xor(view, IdxGen(view), 0) throws RangeError');
});
}, views);

View File

@ -14,6 +14,8 @@ var sab = new SharedArrayBuffer(8);
testWithBigIntTypedArrayConstructors(function(TA) {
let view = new TA(sab);
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, () => Atomics.xor(view, IdxGen(view), 0));
assert.throws(RangeError, function() {
Atomics.xor(view, IdxGen(view), 0);
}, 'Atomics.xor(view, IdxGen(view), 0) throws RangeError');
});
});

View File

@ -12,5 +12,7 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
var buffer = new ArrayBuffer(16);
testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.xor(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.xor(new TA(buffer), 0, 0);
}, 'Atomics.xor(new TA(buffer), 0, 0) throws TypeError');
});

View File

@ -10,5 +10,7 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
---*/
testWithAtomicsNonViewValues(function(view) {
assert.throws(TypeError, (() => Atomics.xor(view, 0, 0)));
assert.throws(TypeError, function() {
Atomics.xor(view, 0, 0);
}, 'Atomics.xor(view, 0, 0) throws TypeError');
});

View File

@ -13,5 +13,7 @@ var buffer = new ArrayBuffer(16);
var views = intArrayConstructors.slice();
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.xor(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.xor(new TA(buffer), 0, 0);
}, 'Atomics.xor(new TA(buffer), 0, 0) throws TypeError');
}, views);

View File

@ -12,5 +12,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
var buffer = new SharedArrayBuffer(1024);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, (() => Atomics.xor(new TA(buffer), 0, 0)));
assert.throws(TypeError, function() {
Atomics.xor(new TA(buffer), 0, 0);
}, 'Atomics.xor(new TA(buffer), 0, 0) throws TypeError');
}, floatArrayConstructors);