mirror of https://github.com/tc39/test262.git
Atomics.* assertion messages and formatting
This commit is contained in:
parent
d3980866c8
commit
4adc41eccf
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.add
|
||||
description: >
|
||||
Atomics.add will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.add(i64a, 0, 1n), 0n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.add(i64a, 0, 1n), 0n, 'Atomics.add(i64a, 0, 1n) returns 0n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.add
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.add(view, 0, 1n);
|
||||
}, `Atomics.add(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.add(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1);
|
||||
assert.sameValue(Atomics.add(i32a, 0, 1), 0, 'Atomics.add(i32a, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.and
|
||||
description: >
|
||||
Atomics.and will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.and(i64a, 0, 1n), 0n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 0n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.and(i64a, 0, 1n), 0n, 'Atomics.and(i64a, 0, 1n) returns 0n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 0n, 'Atomics.load(i64a, 0) returns 0n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.and
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.and(view, 0, 1n);
|
||||
}, `Atomics.and(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.and(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0);
|
||||
assert.sameValue(Atomics.and(i32a, 0, 1), 0, 'Atomics.and(i32a, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.compareExchange
|
||||
description: >
|
||||
Atomics.compareExchange will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.compareExchange(i64a, 0, 0n, 1n), 0n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.compareExchange(i64a, 0, 0n, 1n), 0n, 'Atomics.compareExchange(i64a, 0, 0n, 1n) returns 0n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.compareExchange
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.compareExchange(view, 0, 0n, 0n);
|
||||
}, `Atomics.compareExchange(new ${TA.name}(buffer), 0, 0n, 0n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.compareExchange(i32a, 0, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1);
|
||||
assert.sameValue(Atomics.compareExchange(i32a, 0, 0, 1), 0, 'Atomics.compareExchange(i32a, 0, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.exchange
|
||||
description: >
|
||||
Atomics.exchange will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.exchange(i64a, 0, 1n), 0n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.exchange(i64a, 0, 1n), 0n, 'Atomics.exchange(i64a, 0, 1n) returns 0n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.exchange
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.exchange(view, 0, 0n);
|
||||
}, `Atomics.exchange(new ${TA.name}(buffer), 0, 0n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.exchange(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1);
|
||||
assert.sameValue(Atomics.exchange(i32a, 0, 1), 0, 'Atomics.exchange(i32a, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.load
|
||||
description: >
|
||||
Atomics.load will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.load(i64a, 0), 0n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.load(i64a, 0), 0n, 'Atomics.load(i64a, 0) returns 0n');
|
||||
|
|
|
@ -12,4 +12,4 @@ const i32a = new Int32Array(
|
|||
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');
|
||||
|
|
|
@ -17,5 +17,5 @@ const i64a = new BigInt64Array(
|
|||
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');
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.notify(i32a, 0, 0), 0);
|
||||
assert.sameValue(Atomics.notify(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.notify(i32a, 0, 0), 0, 'Atomics.notify(i32a, 0, 0) returns 0');
|
||||
assert.sameValue(Atomics.notify(i32a, 0, 1), 0, 'Atomics.notify(i32a, 0, 1) returns 0');
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.or
|
||||
description: >
|
||||
Atomics.or will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.or(i64a, 0, 1n), 0n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.or(i64a, 0, 1n), 0n, 'Atomics.or(i64a, 0, 1n) returns 0n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.or
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.or(view, 0, 1n);
|
||||
}, `Atomics.or(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.or(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1);
|
||||
assert.sameValue(Atomics.or(i32a, 0, 1), 0, 'Atomics.or(i32a, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.store
|
||||
description: >
|
||||
Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n, 'Atomics.store(i64a, 0, 1n) returns 1n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.store
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.store(view, 0, 1n);
|
||||
}, `Atomics.store(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.store(i32a, 0, 1), 1);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1);
|
||||
assert.sameValue(Atomics.store(i32a, 0, 1), 1, 'Atomics.store(i32a, 0, 1) returns 1');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1, 'Atomics.load(i32a, 0) returns 1');
|
||||
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.sub
|
||||
description: >
|
||||
Atomics.sub will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n);
|
||||
assert.sameValue(Atomics.sub(i64a, 0, 1n), 1n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 0n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n, 'Atomics.store(i64a, 0, 1n) returns 1n');
|
||||
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');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.sub
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.sub(view, 0, 1n);
|
||||
}, `Atomics.sub(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
|
|
|
@ -12,7 +12,7 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.store(i32a, 0, 1), 1);
|
||||
assert.sameValue(Atomics.sub(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0);
|
||||
assert.sameValue(Atomics.store(i32a, 0, 1), 1, 'Atomics.store(i32a, 0, 1) returns 1');
|
||||
assert.sameValue(Atomics.sub(i32a, 0, 1), 0, 'Atomics.sub(i32a, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');
|
||||
|
||||
|
|
|
@ -14,10 +14,7 @@ info: |
|
|||
4.If bufferData is a Data Block, return false.
|
||||
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 = {
|
||||
valueOf: function() {
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.xor
|
||||
description: >
|
||||
Atomics.xor will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const i64a = new BigInt64Array(
|
||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.xor(i64a, 0, 1n), 0n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
|
||||
assert.sameValue(Atomics.xor(i64a, 0, 1n), 0n, 'Atomics.xor(i64a, 0, 1n) returns 0n');
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n, 'Atomics.load(i64a, 0) returns 1n');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.xor
|
||||
description: >
|
||||
|
@ -8,11 +7,11 @@ description: >
|
|||
includes: [testBigIntTypedArray.js]
|
||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||
|
||||
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.xor(view, 0, 1n);
|
||||
}, `Atomics.xor(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
|
|
|
@ -12,6 +12,6 @@ const i32a = new Int32Array(
|
|||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.and(i32a, 0, 1), 0);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0);
|
||||
assert.sameValue(Atomics.and(i32a, 0, 1), 0, 'Atomics.and(i32a, 0, 1) returns 0');
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');
|
||||
|
||||
|
|
Loading…
Reference in New Issue