Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Atomics / sub / non-shared-bufferdata.js
blob3f36ea5eea7fdf46774e9b2f6c3da1b9f002cf9c
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-atomics.sub
7 description: >
8   Atomics.sub will operate on TA when TA.buffer is not a SharedArrayBuffer
9 includes: [testTypedArray.js]
10 features: [ArrayBuffer, Atomics, TypedArray]
11 ---*/
12 testWithAtomicsFriendlyTypedArrayConstructors(TA => {
13   const view = new TA(
14     new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4)
15   );
17   assert.sameValue(Atomics.store(view, 0, 1), 1, 'Atomics.store(view, 0, 1) returns 1');
18   assert.sameValue(Atomics.sub(view, 0, 1), 1, 'Atomics.sub(view, 0, 1) returns 1');
19   assert.sameValue(Atomics.load(view, 0), 0, 'Atomics.load(view, 0) returns 0');
20 });
22 reportCompare(0, 0);