2020-05-20 20:16:53 +02:00
|
|
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
2020-05-13 19:59:57 +02:00
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
esid: sec-atomics.compareExchange
|
|
|
|
description: >
|
|
|
|
Atomics.compareExchange throws when operating on non-sharable integer TypedArrays
|
|
|
|
includes: [testTypedArray.js]
|
|
|
|
features: [ArrayBuffer, Atomics, TypedArray]
|
|
|
|
---*/
|
2020-05-27 21:00:02 +02:00
|
|
|
testWithNonAtomicsFriendlyTypedArrayConstructors(TA => {
|
|
|
|
const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4);
|
2020-05-13 19:59:57 +02:00
|
|
|
const view = new TA(buffer);
|
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
|
|
|
Atomics.compareExchange(view, 0, 0, 0);
|
2020-05-13 22:40:38 +02:00
|
|
|
}, `Atomics.compareExchange(new ${TA.name}(buffer), 0, 0, 0) throws TypeError`);
|
2020-05-13 19:59:57 +02:00
|
|
|
});
|