Atomics.* assertion messages and formatting

This commit is contained in:
Rick Waldron 2020-05-20 14:37:33 -04:00
parent d3980866c8
commit 4adc41eccf
29 changed files with 57 additions and 113 deletions

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.add esid: sec-atomics.add
description: > description: >
Atomics.add will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.add will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.add(i64a, 0, 1n), 0n, 'Atomics.add(i64a, 0, 1n) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
);
assert.sameValue(Atomics.add(i64a, 0, 1n), 0n);
assert.sameValue(Atomics.load(i64a, 0), 1n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.add esid: sec-atomics.add
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.add(view, 0, 1n); Atomics.add(view, 0, 1n);
}, `Atomics.add(new ${TA.name}(buffer), 0, 1n) throws TypeError`); }, `Atomics.add(new ${TA.name}(buffer), 0, 1n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.add(i32a, 0, 1), 0); assert.sameValue(Atomics.add(i32a, 0, 1), 0, 'Atomics.add(i32a, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 1); assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.and esid: sec-atomics.and
description: > description: >
Atomics.and will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.and will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.and(i64a, 0, 1n), 0n, 'Atomics.and(i64a, 0, 1n) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 0n, 'Atomics.load(i64a, 0) returns 0n');
);
assert.sameValue(Atomics.and(i64a, 0, 1n), 0n);
assert.sameValue(Atomics.load(i64a, 0), 0n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.and esid: sec-atomics.and
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.and(view, 0, 1n); Atomics.and(view, 0, 1n);
}, `Atomics.and(new ${TA.name}(buffer), 0, 1n) throws TypeError`); }, `Atomics.and(new ${TA.name}(buffer), 0, 1n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.and(i32a, 0, 1), 0); assert.sameValue(Atomics.and(i32a, 0, 1), 0, 'Atomics.and(i32a, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 0); assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.compareExchange esid: sec-atomics.compareExchange
description: > description: >
Atomics.compareExchange will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.compareExchange will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.compareExchange(i64a, 0, 0n, 1n), 0n, 'Atomics.compareExchange(i64a, 0, 0n, 1n) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
);
assert.sameValue(Atomics.compareExchange(i64a, 0, 0n, 1n), 0n);
assert.sameValue(Atomics.load(i64a, 0), 1n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.compareExchange esid: sec-atomics.compareExchange
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.compareExchange(view, 0, 0n, 0n); Atomics.compareExchange(view, 0, 0n, 0n);
}, `Atomics.compareExchange(new ${TA.name}(buffer), 0, 0n, 0n) throws TypeError`); }, `Atomics.compareExchange(new ${TA.name}(buffer), 0, 0n, 0n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.compareExchange(i32a, 0, 0, 1), 0); assert.sameValue(Atomics.compareExchange(i32a, 0, 0, 1), 0, 'Atomics.compareExchange(i32a, 0, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 1); assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.exchange esid: sec-atomics.exchange
description: > description: >
Atomics.exchange will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.exchange will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.exchange(i64a, 0, 1n), 0n, 'Atomics.exchange(i64a, 0, 1n) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
);
assert.sameValue(Atomics.exchange(i64a, 0, 1n), 0n);
assert.sameValue(Atomics.load(i64a, 0), 1n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.exchange esid: sec-atomics.exchange
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.exchange(view, 0, 0n); Atomics.exchange(view, 0, 0n);
}, `Atomics.exchange(new ${TA.name}(buffer), 0, 0n) throws TypeError`); }, `Atomics.exchange(new ${TA.name}(buffer), 0, 0n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.exchange(i32a, 0, 1), 0); assert.sameValue(Atomics.exchange(i32a, 0, 1), 0, 'Atomics.exchange(i32a, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 1); assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');

View File

@ -1,15 +1,10 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.load esid: sec-atomics.load
description: > description: >
Atomics.load will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.load will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.load(i64a, 0), 0n, 'Atomics.load(i64a, 0) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
assert.sameValue(Atomics.load(i64a, 0), 0n);

View File

@ -12,4 +12,4 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.load(i32a, 0), 0); assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');

View File

@ -17,5 +17,5 @@ const i64a = new BigInt64Array(
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8) new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
); );
assert.sameValue(Atomics.notify(i64a, 0, 0), 0); assert.sameValue(Atomics.notify(i64a, 0, 0), 0, 'Atomics.notify(i64a, 0, 0) returns 0');

View File

@ -18,6 +18,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.notify(i32a, 0, 0), 0); assert.sameValue(Atomics.notify(i32a, 0, 0), 0, 'Atomics.notify(i32a, 0, 0) returns 0');
assert.sameValue(Atomics.notify(i32a, 0, 1), 0); assert.sameValue(Atomics.notify(i32a, 0, 1), 0, 'Atomics.notify(i32a, 0, 1) returns 0');

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.or esid: sec-atomics.or
description: > description: >
Atomics.or will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.or will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.or(i64a, 0, 1n), 0n, 'Atomics.or(i64a, 0, 1n) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
);
assert.sameValue(Atomics.or(i64a, 0, 1n), 0n);
assert.sameValue(Atomics.load(i64a, 0), 1n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.or esid: sec-atomics.or
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.or(view, 0, 1n); Atomics.or(view, 0, 1n);
}, `Atomics.or(new ${TA.name}(buffer), 0, 1n) throws TypeError`); }, `Atomics.or(new ${TA.name}(buffer), 0, 1n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.or(i32a, 0, 1), 0); assert.sameValue(Atomics.or(i32a, 0, 1), 0, 'Atomics.or(i32a, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 1); assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.store esid: sec-atomics.store
description: > description: >
Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.store(i64a, 0, 1n), 1n, 'Atomics.store(i64a, 0, 1n) returns 1n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
);
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n);
assert.sameValue(Atomics.load(i64a, 0), 1n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.store esid: sec-atomics.store
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.store(view, 0, 1n); Atomics.store(view, 0, 1n);
}, `Atomics.store(new ${TA.name}(buffer), 0, 1n) throws TypeError`); }, `Atomics.store(new ${TA.name}(buffer), 0, 1n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.store(i32a, 0, 1), 1); assert.sameValue(Atomics.store(i32a, 0, 1), 1, 'Atomics.store(i32a, 0, 1) returns 1');
assert.sameValue(Atomics.load(i32a, 0), 1); assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');

View File

@ -1,17 +1,12 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.sub esid: sec-atomics.sub
description: > description: >
Atomics.sub will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.sub will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.store(i64a, 0, 1n), 1n, 'Atomics.store(i64a, 0, 1n) returns 1n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.sub(i64a, 0, 1n), 1n, 'Atomics.sub(i64a, 0, 1n) returns 1n');
); assert.sameValue(Atomics.load(i64a, 0), 0n, 'Atomics.load(i64a, 0) returns 0n');
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n);
assert.sameValue(Atomics.sub(i64a, 0, 1n), 1n);
assert.sameValue(Atomics.load(i64a, 0), 0n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.sub esid: sec-atomics.sub
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.sub(view, 0, 1n); Atomics.sub(view, 0, 1n);
}, `Atomics.sub(new ${TA.name}(buffer), 0, 1n) throws TypeError`); }, `Atomics.sub(new ${TA.name}(buffer), 0, 1n) throws TypeError`);

View File

@ -12,7 +12,7 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.store(i32a, 0, 1), 1); assert.sameValue(Atomics.store(i32a, 0, 1), 1, 'Atomics.store(i32a, 0, 1) returns 1');
assert.sameValue(Atomics.sub(i32a, 0, 1), 0); assert.sameValue(Atomics.sub(i32a, 0, 1), 0, 'Atomics.sub(i32a, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 0); assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');

View File

@ -14,10 +14,7 @@ info: |
4.If bufferData is a Data Block, return false. 4.If bufferData is a Data Block, return false.
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT));
const i64a = new BigInt64Array(
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT)
);
const poisoned = { const poisoned = {
valueOf: function() { valueOf: function() {

View File

@ -1,16 +1,11 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.xor esid: sec-atomics.xor
description: > description: >
Atomics.xor will operate on TA when TA.buffer is not a SharedArrayBuffer Atomics.xor will operate on TA when TA.buffer is not a SharedArrayBuffer
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const i64a = new BigInt64Array( assert.sameValue(Atomics.xor(i64a, 0, 1n), 0n, 'Atomics.xor(i64a, 0, 1n) returns 0n');
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
);
assert.sameValue(Atomics.xor(i64a, 0, 1n), 0n);
assert.sameValue(Atomics.load(i64a, 0), 1n);

View File

@ -1,6 +1,5 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved. // Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
esid: sec-atomics.xor esid: sec-atomics.xor
description: > description: >
@ -8,11 +7,11 @@ description: >
includes: [testBigIntTypedArray.js] includes: [testBigIntTypedArray.js]
features: [ArrayBuffer, Atomics, BigInt, TypedArray] features: [ArrayBuffer, Atomics, BigInt, TypedArray]
---*/ ---*/
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4); const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableBigIntTypedArrayConstructors(function(TA) { testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
const view = new TA(buffer); const view = new TA(buffer);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.xor(view, 0, 1n); Atomics.xor(view, 0, 1n);
}, `Atomics.xor(new ${TA.name}(buffer), 0, 1n) throws TypeError`); }, `Atomics.xor(new ${TA.name}(buffer), 0, 1n) throws TypeError`);

View File

@ -12,6 +12,6 @@ const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
assert.sameValue(Atomics.and(i32a, 0, 1), 0); assert.sameValue(Atomics.and(i32a, 0, 1), 0, 'Atomics.and(i32a, 0, 1) returns 0');
assert.sameValue(Atomics.load(i32a, 0), 0); assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');