Coverage: more Atomics.waitAsync tests, fixes, improved messages.

This commit is contained in:
Rick Waldron 2020-10-08 15:56:06 -04:00
parent 04517c7ded
commit 6d8ab9c35e
99 changed files with 655 additions and 560 deletions

View File

@ -54,6 +54,8 @@ defines:
})(this); })(this);
} }
$262.agent.setTimeout = setTimeout;
$262.agent.getReportAsync = function() { $262.agent.getReportAsync = function() {
return new Promise(function(resolve) { return new Promise(function(resolve) {
(function loop() { (function loop() {

View File

@ -16,9 +16,7 @@ features: [Atomics, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray]
flags: [CanBlockIsTrue] flags: [CanBlockIsTrue]
---*/ ---*/
const i32a = new Int32Array( const i32a = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4));
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
const valueOf = { const valueOf = {
valueOf: function() { valueOf: function() {

View File

@ -19,7 +19,7 @@ info: |
includes: [testAtomics.js] includes: [testAtomics.js]
features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray] features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
); );
@ -27,7 +27,7 @@ const i32a = new Int32Array(
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0); Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0);
}, '`Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0)` throws RangeError'); }, '`Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0)` throws a RangeError exception');
}); });

View File

@ -18,11 +18,11 @@ info: |
includes: [testAtomics.js] includes: [testAtomics.js]
features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray, BigInt] features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8));
testWithAtomicsOutOfBoundsIndices(function(IdxGen) { testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0); Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0);
}, '`Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0)` throws RangeError'); }, '`Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0)` throws a RangeError exception');
}); });

View File

@ -17,7 +17,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -49,43 +49,47 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -16,7 +16,7 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const valueOf = { const valueOf = {
@ -34,19 +34,19 @@ const toPrimitive = {
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, false).value, Atomics.waitAsync(i64a, 0, 0n, false).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, false).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, valueOf).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value is "timed-out"'
); );
Promise.all([ Promise.all([
@ -54,7 +54,7 @@ Promise.all([
Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], 'timed-out'); assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"');
assert.sameValue(outcomes[1], 'timed-out'); assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"');
assert.sameValue(outcomes[2], 'timed-out'); assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -9,7 +9,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, Atomics, BigInt] features: [Atomics.waitAsync, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
$262.agent.start(` $262.agent.start(`
(async () => { (async () => {
@ -54,17 +54,17 @@ $262.agent.start(`
assert.sameValue( assert.sameValue(
outcomes[0], outcomes[0],
'A timed-out', 'A timed-out',
'"A " + (await Atomics.waitAsync(view, 0, 0n, 0).value resolves to "A timed-out"' 'The value of outcomes[0] is "A timed-out"'
); );
assert.sameValue( assert.sameValue(
outcomes[1], outcomes[1],
'B not-equal', 'B not-equal',
'"B " + (await Atomics.waitAsync(view, 0, 37n, 0).value resolves to "B not-equal"' 'The value of outcomes[1] is "B not-equal"'
); );
assert.sameValue( assert.sameValue(
outcomes[2], outcomes[2],
'C not-equal,not-equal,not-equal,not-equal,not-equal', 'C not-equal,not-equal,not-equal,not-equal,not-equal',
'All C values are not equal' 'The value of outcomes[2] is "C not-equal,not-equal,not-equal,not-equal,not-equal"'
); );
})().then($DONE, $DONE); })().then($DONE, $DONE);

View File

@ -17,7 +17,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -33,12 +33,17 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1');
assert.sameValue(
Atomics.notify(i64a, 0),
1,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 1'
);
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i64a, 0, 0n, NaN).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,7 +17,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array( const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
); );
@ -30,14 +30,14 @@ const poisoned = {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned); Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, -7.999, poisoned, poisoned); Atomics.waitAsync(i64a, -7.999, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, -7.999, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, -7.999, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, -1, poisoned, poisoned); Atomics.waitAsync(i64a, -1, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, -300, poisoned, poisoned); Atomics.waitAsync(i64a, -300, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, -300, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, -300, poisoned, poisoned)` throws a RangeError exception');

View File

@ -17,7 +17,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -32,13 +32,17 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, -5).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -16,13 +16,9 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, destructuring-binding, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, destructuring-binding, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
Promise.all([Atomics.waitAsync(i64a, 0, 0n, -1).value]).then(([outcome]) => { Promise.all([Atomics.waitAsync(i64a, 0, 0n, -1).value]).then(([outcome]) => {
assert.sameValue( assert.sameValue(outcome, 'timed-out', 'The value of `outcome` is "timed-out"');
outcome,
'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, -1).value resolves to "timed-out"'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -46,16 +46,15 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.add(i64a, 0, 1n); Atomics.add(i64a, 0, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.and(i64a, 0, 1n); Atomics.and(i64a, 0, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.compareExchange(i64a, 0, 0n, 1n); Atomics.compareExchange(i64a, 0, 0n, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.exchange(i64a, 0, 1n); Atomics.exchange(i64a, 0, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.or(i64a, 0, 1n); Atomics.or(i64a, 0, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.store(i64a, 0, 0b1010n); Atomics.store(i64a, 0, 0b1010n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.sub(i64a, 0, 1n); Atomics.sub(i64a, 0, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -45,17 +45,16 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
Atomics.xor(i64a, 0, 1n); Atomics.xor(i64a, 0, 1n);
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"');
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'timed-out', 0,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -21,7 +21,7 @@ info: |
features: [Atomics.waitAsync, Float32Array, Float64Array, Int8Array, TypedArray, Uint16Array, Uint8Array, Uint8ClampedArray, arrow-function, SharedArrayBuffer, Atomics] features: [Atomics.waitAsync, Float32Array, Float64Array, Int8Array, TypedArray, Uint16Array, Uint8Array, Uint8ClampedArray, arrow-function, SharedArrayBuffer, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const poisoned = { const poisoned = {
valueOf() { valueOf() {
throw new Test262Error('should not evaluate this code'); throw new Test262Error('should not evaluate this code');
@ -31,5 +31,5 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8)); const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8));
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8)); Atomics.waitAsync(view, poisoned, poisoned, poisoned);` throws TypeError'); }, '`const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8)); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -20,7 +20,7 @@ info: |
features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, BigInt, arrow-function] features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, BigInt, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const poisoned = { const poisoned = {
@ -31,8 +31,8 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(i64a, 0, 0n, 0); Atomics.waitAsync(i64a, 0, 0n, 0);
}, '`Atomics.waitAsync(i64a, 0, 0n, 0)` throws TypeError'); }, '`Atomics.waitAsync(i64a, 0, 0n, 0)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(i64a, poisoned, poisoned, poisoned); Atomics.waitAsync(i64a, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -24,7 +24,8 @@ info: |
features: [Atomics.waitAsync, arrow-function, Atomics] features: [Atomics.waitAsync, arrow-function, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const poisoned = { const poisoned = {
valueOf() { valueOf() {
throw new Test262Error('should not evaluate this code'); throw new Test262Error('should not evaluate this code');
@ -33,8 +34,8 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync({}, 0, 0n, 0); Atomics.waitAsync({}, 0, 0n, 0);
}, '`Atomics.waitAsync({}, 0, 0n, 0)` throws TypeError'); }, '`Atomics.waitAsync({}, 0, 0n, 0)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync({}, poisoned, poisoned, poisoned); Atomics.waitAsync({}, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -24,7 +24,7 @@ info: |
features: [Atomics.waitAsync, Symbol, arrow-function, Atomics] features: [Atomics.waitAsync, Symbol, arrow-function, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const poisoned = { const poisoned = {
valueOf() { valueOf() {
throw new Test262Error('should not evaluate this code'); throw new Test262Error('should not evaluate this code');
@ -33,29 +33,29 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(null, poisoned, poisoned, poisoned); Atomics.waitAsync(null, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(undefined, poisoned, poisoned, poisoned); Atomics.waitAsync(undefined, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(true, poisoned, poisoned, poisoned); Atomics.waitAsync(true, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(false, poisoned, poisoned, poisoned); Atomics.waitAsync(false, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync('***string***', poisoned, poisoned, poisoned); Atomics.waitAsync('***string***', poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(\'***string***\', poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync("***string***", poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned); Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(Symbol('***symbol***'), poisoned, poisoned, poisoned); Atomics.waitAsync(Symbol('***symbol***'), poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(Symbol(\'***symbol***\'), poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(Symbol("***symbol***"), poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -25,7 +25,7 @@ info: |
includes: [detachArrayBuffer.js] includes: [detachArrayBuffer.js]
features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, BigInt] features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array( const i64a = new BigInt64Array(
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
); );
@ -44,5 +44,5 @@ try {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, poisoned, poisoned, poisoned); Atomics.waitAsync(i64a, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -19,7 +19,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -51,43 +51,47 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, null).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, null).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -16,9 +16,8 @@ info: |
Null -> Return +0. Null -> Return +0.
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt, arrow-function]
flags: [async]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const valueOf = { const valueOf = {
@ -36,27 +35,17 @@ const toPrimitive = {
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, null).value, Atomics.waitAsync(i64a, 0, 0n, null).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, null).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, null).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, valueOf).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value is "timed-out"'
); );
Promise.all([
Atomics.waitAsync(i64a, 0, 0n, null).value,
Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value
]).then(outcomes => {
assert.sameValue(outcomes[0], 'timed-out');
assert.sameValue(outcomes[1], 'timed-out');
assert.sameValue(outcomes[2], 'timed-out');
}).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -60,43 +60,47 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, toString).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toString).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -21,7 +21,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt, arrow-function]
flags: [async] flags: [async]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const valueOf = { const valueOf = {
@ -45,19 +45,19 @@ const toPrimitive = {
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, valueOf).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, toString).value, Atomics.waitAsync(i64a, 0, 0n, toString).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toString).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, toString).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value is "timed-out"'
); );
Promise.all([ Promise.all([
@ -65,7 +65,7 @@ Promise.all([
Atomics.waitAsync(i64a, 0, 0n, toString).value, Atomics.waitAsync(i64a, 0, 0n, toString).value,
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], 'timed-out'); assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"');
assert.sameValue(outcomes[1], 'timed-out'); assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"');
assert.sameValue(outcomes[2], 'timed-out'); assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -20,7 +20,7 @@ info: |
5. If accessIndex length, throw a RangeError exception. 5. If accessIndex length, throw a RangeError exception.
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array( const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
); );
@ -33,14 +33,14 @@ const poisoned = {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, Infinity, poisoned, poisoned); Atomics.waitAsync(i64a, Infinity, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, Infinity, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, Infinity, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, -1, poisoned, poisoned); Atomics.waitAsync(i64a, -1, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, 4, poisoned, poisoned); Atomics.waitAsync(i64a, 4, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, 4, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, 4, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i64a, 200, poisoned, poisoned); Atomics.waitAsync(i64a, 200, poisoned, poisoned);
}, '`Atomics.waitAsync(i64a, 200, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i64a, 200, poisoned, poisoned)` throws a RangeError exception');

View File

@ -20,7 +20,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -63,19 +63,23 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'poisonedValueOf', 'poisonedValueOf',
'Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf) throws' '(await $262.agent.getReportAsync()) resolves to the value "poisonedValueOf"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'poisonedToPrimitive', 'poisonedToPrimitive',
'Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive) throws' '(await $262.agent.getReportAsync()) resolves to the value "poisonedToPrimitive"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -18,7 +18,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const poisonedValueOf = { const poisonedValueOf = {
@ -35,8 +35,8 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf); Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf);
}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive); Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive);
}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws a Test262Error exception');

View File

@ -32,7 +32,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -75,19 +75,23 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'A TypeError', 'A TypeError',
'Atomics.waitAsync(i64a, Symbol("1"), ..., ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'B TypeError', 'B TypeError',
'Atomics.waitAsync(i64a, Symbol("2"), ..., ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -31,7 +31,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array( const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
); );
@ -50,19 +50,19 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf); Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf);
}, '`Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive); Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive);
}, '`Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, Symbol('1'), poisonedValueOf, poisonedValueOf); Atomics.waitAsync(i64a, Symbol('1'), poisonedValueOf, poisonedValueOf);
}, '`Atomics.waitAsync(i64a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws TypeError'); }, '`Atomics.waitAsync(i64a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, Symbol('2'), poisonedToPrimitive, poisonedToPrimitive); Atomics.waitAsync(i64a, Symbol('2'), poisonedToPrimitive, poisonedToPrimitive);
}, '`Atomics.waitAsync(i64a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws TypeError'); }, '`Atomics.waitAsync(i64a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws a TypeError exception');

View File

@ -19,7 +19,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -50,19 +50,23 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'A TypeError', 'A TypeError',
'Atomics.waitAsync(i64a, 0, 0n, Symbol("1")) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'B TypeError', 'B TypeError',
'Atomics.waitAsync(i64a, 0, 0n, Symbol("2")) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,7 +17,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const poisonedValueOf = { const poisonedValueOf = {
@ -34,16 +34,16 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf); Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf);
}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive); Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive);
}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws a Test262Error exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, 0, 0n, Symbol('foo')); Atomics.waitAsync(i64a, 0, 0n, Symbol('foo'));
}, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws TypeError'); }, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, 0, 0n, Symbol('foo')); Atomics.waitAsync(i64a, 0, 0n, Symbol('foo'));
}, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws TypeError'); }, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws a TypeError exception');

View File

@ -23,7 +23,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -66,19 +66,23 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'A TypeError', 'A TypeError',
'Atomics.waitAsync(i64a, 0, Symbol("1"), ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'B TypeError', 'B TypeError',
'Atomics.waitAsync(i64a, 0, Symbol("2"), ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array( const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
); );
@ -41,17 +41,17 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf); Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf);
}, '`Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive); Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive);
}, '`Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf); Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf);
}, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf)` throws TypeError'); }, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf)` throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive); Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive);
}, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive)` throws TypeError'); }, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive)` throws a TypeError exception');

View File

@ -17,7 +17,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
$262.agent.start(` $262.agent.start(`
@ -46,25 +46,29 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -16,9 +16,10 @@ info: |
Boolean -> If argument is true, return 1. If argument is false, return +0. Boolean -> If argument is true, return 1. If argument is false, return +0.
flags: [async] flags: [async]
includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const valueOf = { const valueOf = {
@ -33,12 +34,31 @@ const toPrimitive = {
} }
}; };
let outcomes = [];
let lifespan = 1000;
let start = $262.agent.monotonicNow();
(function wait() {
let elapsed = $262.agent.monotonicNow() - start;
if (elapsed > lifespan) {
$DONE('Test timed out');
return;
}
if (outcomes.length) {
assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"');
assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"');
assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"');
$DONE();
return;
}
$262.agent.setTimeout(wait, 0);
})();
Promise.all([ Promise.all([
Atomics.waitAsync(i64a, 0, 0n, true).value, Atomics.waitAsync(i64a, 0, 0n, true).value,
Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value
]).then(outcomes => { ]).then(results => outcomes = results, $DONE);
assert.sameValue(outcomes[0], 'timed-out');
assert.sameValue(outcomes[1], 'timed-out');
assert.sameValue(outcomes[2], 'timed-out');
}).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const WAIT_INDEX = 0; const WAIT_INDEX = 0;
const RUNNING = 1; const RUNNING = 1;
@ -57,12 +57,16 @@ const i64a = new BigInt64Array(
$262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => {
assert.sameValue(agentCount, BigInt(NUMAGENT)); assert.sameValue(
agentCount,
BigInt(NUMAGENT),
'The value of `agentCount` must return the same value returned by BigInt(NUMAGENT)'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT), Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT),
NOTIFYCOUNT, NOTIFYCOUNT,
'Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT'
); );
const reports = [ const reports = [

View File

@ -18,23 +18,11 @@ info: |
5.If q is NaN, let t be +, else let t be max(q, 0) 5.If q is NaN, let t be +, else let t be max(q, 0)
flags: [async] flags: [async]
includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.start(`
$262.agent.receiveBroadcast(async (sab) => {
var i64a = new BigInt64Array(sab);
$262.agent.sleep(1000);
Atomics.notify(i64a, 0, 4);
$262.agent.leaving();
});
`);
$262.agent.safeBroadcast(i64a);
const valueOf = { const valueOf = {
valueOf() { valueOf() {
return undefined; return undefined;
@ -53,8 +41,10 @@ Promise.all([
Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value,
Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], 'ok'); assert.sameValue(outcomes[0], 'ok', 'The value of outcomes[0] is "ok"');
assert.sameValue(outcomes[1], 'ok'); assert.sameValue(outcomes[1], 'ok', 'The value of outcomes[1] is "ok"');
assert.sameValue(outcomes[2], 'ok'); assert.sameValue(outcomes[2], 'ok', 'The value of outcomes[2] is "ok"');
assert.sameValue(outcomes[3], 'ok'); assert.sameValue(outcomes[3], 'ok', 'The value of outcomes[3] is "ok"');
}).then($DONE, $DONE); }).then($DONE, $DONE);
Atomics.notify(i64a, 0);

View File

@ -26,7 +26,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const WAIT_INDEX = 0; const WAIT_INDEX = 0;
const RUNNING = 1; const RUNNING = 1;
@ -59,12 +59,16 @@ const i64a = new BigInt64Array(
$262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => {
assert.sameValue(agentCount, BigInt(NUMAGENT)); assert.sameValue(
agentCount,
BigInt(NUMAGENT),
'The value of `agentCount` must return the same value returned by BigInt(NUMAGENT)'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT), Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT),
NOTIFYCOUNT, NOTIFYCOUNT,
'Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT'
); );
const reports = [ const reports = [

View File

@ -23,7 +23,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const value = 42n; const value = 42n;
@ -40,23 +40,23 @@ $262.agent.start(`
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
value.toString(), value.toString(),
'Atomics.store(i64a, 0, 42n) returns 42' '(await $262.agent.getReportAsync()) must return the same value returned by value.toString()'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'not-equal', 'not-equal',
'Atomics.waitAsync(i64a, 0, 0n).value resolves to "not-equal"' '(await $262.agent.getReportAsync()) resolves to the value "not-equal"'
); );
assert.sameValue( assert.sameValue(
Atomics.notify(i64a, 0, 1), Atomics.notify(i64a, 0, 1),
0, 0,
'Atomics.notify(i64a, 0, 1) returns 0 (nothing to notify)' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0, 1) must return 0'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, Atomics, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, Atomics, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
const valueOf = { const valueOf = {
@ -38,6 +38,6 @@ const toPrimitive = {
}; };
Promise.all([Atomics.store(i64a, 0, 42n), Atomics.waitAsync(i64a, 0, 0n).value]).then(outcomes => { Promise.all([Atomics.store(i64a, 0, 42n), Atomics.waitAsync(i64a, 0, 0n).value]).then(outcomes => {
assert.sameValue(outcomes[0], 42n); assert.sameValue(outcomes[0], 42n, 'The value of outcomes[0] is 42n');
assert.sameValue(outcomes[1], 'not-equal'); assert.sameValue(outcomes[1], 'not-equal', 'The value of outcomes[1] is "not-equal"');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const NUMAGENT = 2; const NUMAGENT = 2;
const RUNNING = 4; const RUNNING = 4;
@ -57,28 +57,32 @@ const i64a = new BigInt64Array(
$262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => {
assert.sameValue(agentCount, BigInt(NUMAGENT)); assert.sameValue(
agentCount,
BigInt(NUMAGENT),
'The value of `agentCount` must return the same value returned by BigInt(NUMAGENT)'
);
// Notify index 1, notifies nothing // Notify index 1, notifies nothing
assert.sameValue(Atomics.notify(i64a, 1), 0, 'Atomics.notify(i64a, 1) returns 0'); assert.sameValue(Atomics.notify(i64a, 1), 0, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 1) must return 0');
// Notify index 3, notifies nothing // Notify index 3, notifies nothing
assert.sameValue(Atomics.notify(i64a, 3), 0, 'Atomics.notify(i64a, 3) returns 0'); assert.sameValue(Atomics.notify(i64a, 3), 0, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 3) must return 0');
// Notify index 2, notifies 1 // Notify index 2, notifies 1
assert.sameValue(Atomics.notify(i64a, 2), 1, 'Atomics.notify(i64a, 2) returns 1'); assert.sameValue(Atomics.notify(i64a, 2), 1, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 2) must return 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i64a, 0, 0n, Infinity).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
// Notify index 0, notifies 1 // Notify index 0, notifies 1
assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1'); assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 0) must return 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i64a, 2, 0n, Infinity).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -9,7 +9,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.huge; const TIMEOUT = $262.agent.timeouts.huge;
const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
@ -30,17 +30,23 @@ $262.agent.start(`
`); `);
$262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => {
assert.sameValue(agentCount, 1n); assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n');
assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1');
const lapse = await $262.agent.getReportAsync();
assert(lapse < TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true');
const result = await $262.agent.getReportAsync();
assert.sameValue( assert.sameValue(
result, Atomics.notify(i64a, 0),
'ok', 1,
'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "ok"' 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 1'
); );
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); const lapse = await $262.agent.getReportAsync();
assert(lapse < TIMEOUT, 'The result of evaluating `(lapse < TIMEOUT)` is true');
const result = await $262.agent.getReportAsync();
assert.sameValue(result, 'ok', 'The value of `result` is "ok"');
assert.sameValue(result, 'ok', 'The value of `result` is "ok"');
assert.sameValue(
Atomics.notify(i64a, 0),
0,
'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'
);
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -18,7 +18,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -53,40 +53,40 @@ const i32a = new Int32Array(
); );
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,7 +17,7 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -37,19 +37,19 @@ const toPrimitive = {
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, false).value, Atomics.waitAsync(i32a, 0, 0, false).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, false).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, valueOf).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, toPrimitive).value is "timed-out"'
); );
Promise.all([ Promise.all([
@ -57,7 +57,7 @@ Promise.all([
Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value,
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], 'timed-out'); assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"');
assert.sameValue(outcomes[1], 'timed-out'); assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"');
assert.sameValue(outcomes[2], 'timed-out'); assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -9,7 +9,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, Atomics] features: [Atomics.waitAsync, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
$262.agent.start(` $262.agent.start(`
(async () => { (async () => {
@ -53,17 +53,17 @@ $262.agent.start(`
assert.sameValue( assert.sameValue(
outcomes[0], outcomes[0],
'A timed-out', 'A timed-out',
'"A " + (await Atomics.waitAsync(view, 0, 0, 0).value resolves to "A timed-out"' 'The value of outcomes[0] is "A timed-out"'
); );
assert.sameValue( assert.sameValue(
outcomes[1], outcomes[1],
'B not-equal', 'B not-equal',
'"B " + (await Atomics.waitAsync(view, 0, 37, 0).value resolves to "B not-equal"' 'The value of outcomes[1] is "B not-equal"'
); );
assert.sameValue( assert.sameValue(
outcomes[2], outcomes[2],
'C not-equal,not-equal,not-equal,not-equal,not-equal', 'C not-equal,not-equal,not-equal,not-equal,not-equal',
'All C values are not equal' 'The value of outcomes[2] is "C not-equal,not-equal,not-equal,not-equal,not-equal"'
); );
})().then($DONE, $DONE); })().then($DONE, $DONE);

View File

@ -0,0 +1,38 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-atomics.waitasync
description: >
Undefined timeout arg is coerced to zero
info: |
Atomics.waitAsync( typedArray, index, value, timeout )
1. Return DoWait(async, typedArray, index, value, timeout).
DoWait ( mode, typedArray, index, value, timeout )
6. Let q be ? ToNumber(timeout).
...
Undefined Return NaN.
5.If q is NaN, let t be +, else let t be max(q, 0)
flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/
assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
let {async, value} = Atomics.waitAsync(i32a, 0, 0);
value.then(result => {
assert.sameValue(result, "ok", 'The value of `result` is "ok"');
}, $DONE).then($DONE, $DONE);
Atomics.notify(i32a, 0);

View File

@ -7,4 +7,4 @@ description: Atomics.waitAsync is callable
features: [Atomics.waitAsync, Atomics] features: [Atomics.waitAsync, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');

View File

@ -18,7 +18,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -38,14 +38,14 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i32a, 0, 0, NaN).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,7 +17,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -30,13 +30,13 @@ const poisoned = {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned); Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, -7.999, poisoned, poisoned); Atomics.waitAsync(i32a, -7.999, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, -7.999, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, -7.999, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, -1, poisoned, poisoned); Atomics.waitAsync(i32a, -1, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, -300, poisoned, poisoned); Atomics.waitAsync(i32a, -300, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, -300, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, -300, poisoned, poisoned)` throws a RangeError exception');

View File

@ -18,7 +18,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -37,15 +37,15 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, -5).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,7 +17,7 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, destructuring-binding, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, destructuring-binding, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -28,6 +28,6 @@ Promise.all([
assert.sameValue( assert.sameValue(
outcome, outcome,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, -1).value resolves to "timed-out"' 'The value of `outcome` is "timed-out"'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -26,7 +26,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -52,13 +52,13 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
const lapse = await $262.agent.getReportAsync(); const lapse = await $262.agent.getReportAsync();
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -66,7 +66,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.add(i32a, 0, 1); Atomics.add(i32a, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.and(i32a, 0, 1); Atomics.and(i32a, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.compareExchange(i32a, 0, 0, 1); Atomics.compareExchange(i32a, 0, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.exchange(i32a, 0, 1); Atomics.exchange(i32a, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.or(i32a, 0, 1); Atomics.or(i32a, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.store(i32a, 0, 0b1010); Atomics.store(i32a, 0, 0b1010);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.sub(i32a, 0, 1); Atomics.sub(i32a, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -25,7 +25,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.small; const TIMEOUT = $262.agent.timeouts.small;
@ -51,7 +51,7 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
Atomics.xor(i32a, 0, 1); Atomics.xor(i32a, 0, 1);
@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert( assert(
lapse >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse >= TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync(); const result = await $262.agent.getReportAsync();
@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue( assert.sameValue(
result, result,
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' 'The value of `result` is "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -21,7 +21,7 @@ info: |
features: [Atomics.waitAsync, Float32Array, Float64Array, Int8Array, TypedArray, Uint16Array, Uint8Array, Uint8ClampedArray, arrow-function, SharedArrayBuffer, Atomics] features: [Atomics.waitAsync, Float32Array, Float64Array, Int8Array, TypedArray, Uint16Array, Uint8Array, Uint8ClampedArray, arrow-function, SharedArrayBuffer, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const poisoned = { const poisoned = {
valueOf() { valueOf() {
throw new Test262Error('should not evaluate this code'); throw new Test262Error('should not evaluate this code');
@ -33,53 +33,53 @@ assert.throws(TypeError, () => {
new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8) new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Float64Array( new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Float64Array( new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Float32Array( const view = new Float32Array(
new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Float32Array( new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Float32Array( new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Int16Array( const view = new Int16Array(
new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2) new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Int16Array( new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Int16Array( new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Int8Array( const view = new Int8Array(
new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT) new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Int8Array( new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Int8Array( new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Uint32Array( const view = new Uint32Array(
new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Uint32Array( new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Uint32Array( new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Uint16Array( const view = new Uint16Array(
new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2) new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Uint16Array( new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Uint16Array( new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Uint8Array( const view = new Uint8Array(
new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT) new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Uint8Array( new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Uint8Array( new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
const view = new Uint8ClampedArray( const view = new Uint8ClampedArray(
new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT) new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT)
); );
Atomics.waitAsync(view, poisoned, poisoned, poisoned); Atomics.waitAsync(view, poisoned, poisoned, poisoned);
}, '`const view = new Uint8ClampedArray( new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); }, '`const view = new Uint8ClampedArray( new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -20,7 +20,7 @@ info: |
features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, arrow-function] features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -33,8 +33,8 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(i32a, 0, 0, 0); Atomics.waitAsync(i32a, 0, 0, 0);
}, '`Atomics.waitAsync(i32a, 0, 0, 0)` throws TypeError'); }, '`Atomics.waitAsync(i32a, 0, 0, 0)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(i32a, poisoned, poisoned, poisoned); Atomics.waitAsync(i32a, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -24,7 +24,7 @@ info: |
features: [Atomics.waitAsync, arrow-function, Atomics] features: [Atomics.waitAsync, arrow-function, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const poisoned = { const poisoned = {
valueOf() { valueOf() {
throw new Test262Error('should not evaluate this code'); throw new Test262Error('should not evaluate this code');
@ -33,8 +33,8 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync({}, 0, 0, 0); Atomics.waitAsync({}, 0, 0, 0);
}, '`Atomics.waitAsync({}, 0, 0, 0)` throws TypeError'); }, '`Atomics.waitAsync({}, 0, 0, 0)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync({}, poisoned, poisoned, poisoned); Atomics.waitAsync({}, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -24,7 +24,7 @@ info: |
features: [Atomics.waitAsync, Symbol, arrow-function, Atomics] features: [Atomics.waitAsync, Symbol, arrow-function, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const poisoned = { const poisoned = {
valueOf() { valueOf() {
throw new Test262Error('should not evaluate this code'); throw new Test262Error('should not evaluate this code');
@ -33,28 +33,28 @@ const poisoned = {
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(null, poisoned, poisoned, poisoned); Atomics.waitAsync(null, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(undefined, poisoned, poisoned, poisoned); Atomics.waitAsync(undefined, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(true, poisoned, poisoned, poisoned); Atomics.waitAsync(true, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(false, poisoned, poisoned, poisoned); Atomics.waitAsync(false, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync('***string***', poisoned, poisoned, poisoned); Atomics.waitAsync('***string***', poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(\'***string***\', poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync("***string***", poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned); Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws a TypeError exception');
assert.throws(TypeError, () => { assert.throws(TypeError, () => {
Atomics.waitAsync(Symbol('***symbol***'), poisoned, poisoned, poisoned); Atomics.waitAsync(Symbol('***symbol***'), poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(Symbol(\'***symbol***\'), poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(Symbol("***symbol***"), poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -25,7 +25,7 @@ info: |
includes: [detachArrayBuffer.js] includes: [detachArrayBuffer.js]
features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray] features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -44,4 +44,4 @@ try {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, poisoned, poisoned, poisoned); Atomics.waitAsync(i32a, poisoned, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws TypeError'); }, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws a TypeError exception');

View File

@ -20,7 +20,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -55,40 +55,40 @@ const i32a = new Int32Array(
); );
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, null).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, null).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,9 +17,8 @@ info: |
Null -> Return +0. Null -> Return +0.
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, arrow-function]
flags: [async]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
@ -40,25 +39,15 @@ const toPrimitive = {
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, null).value, Atomics.waitAsync(i32a, 0, 0, null).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, null).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, null).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, valueOf).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, toPrimitive).value is "timed-out"'
); );
Promise.all([
Atomics.waitAsync(i32a, 0, 0, null).value,
Atomics.waitAsync(i32a, 0, 0, valueOf).value,
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
]).then(outcomes => {
assert.sameValue(outcomes[0], "timed-out");
assert.sameValue(outcomes[1], "timed-out");
assert.sameValue(outcomes[2], "timed-out");
}).then($DONE, $DONE);

View File

@ -23,7 +23,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -65,40 +65,40 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, toString).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toString).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, arrow-function]
flags: [async] flags: [async]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -48,17 +48,17 @@ const toPrimitive = {
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, valueOf).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, toString).value, Atomics.waitAsync(i32a, 0, 0, toString).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toString).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, toString).value is "timed-out"'
); );
assert.sameValue( assert.sameValue(
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
'timed-out', 'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' 'The value of Atomics.waitAsync(i32a, 0, 0, toPrimitive).value is "timed-out"'
); );
Promise.all([ Promise.all([
@ -66,7 +66,7 @@ Promise.all([
Atomics.waitAsync(i32a, 0, 0, toString).value, Atomics.waitAsync(i32a, 0, 0, toString).value,
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], "timed-out"); assert.sameValue(outcomes[0], "timed-out", 'The value of outcomes[0] is "timed-out"');
assert.sameValue(outcomes[1], "timed-out"); assert.sameValue(outcomes[1], "timed-out", 'The value of outcomes[1] is "timed-out"');
assert.sameValue(outcomes[2], "timed-out"); assert.sameValue(outcomes[2], "timed-out", 'The value of outcomes[2] is "timed-out"');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -20,7 +20,7 @@ info: |
5. If accessIndex length, throw a RangeError exception. 5. If accessIndex length, throw a RangeError exception.
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -33,13 +33,13 @@ const poisoned = {
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, Infinity, poisoned, poisoned); Atomics.waitAsync(i32a, Infinity, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, Infinity, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, Infinity, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, -1, poisoned, poisoned); Atomics.waitAsync(i32a, -1, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, 4, poisoned, poisoned); Atomics.waitAsync(i32a, 4, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, 4, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, 4, poisoned, poisoned)` throws a RangeError exception');
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
Atomics.waitAsync(i32a, 200, poisoned, poisoned); Atomics.waitAsync(i32a, 200, poisoned, poisoned);
}, '`Atomics.waitAsync(i32a, 200, poisoned, poisoned)` throws RangeError'); }, '`Atomics.waitAsync(i32a, 200, poisoned, poisoned)` throws a RangeError exception');

View File

@ -21,7 +21,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -68,21 +68,21 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'poisonedValueOf', 'poisonedValueOf',
'Atomics.waitAsync(i32a, 0, 0, poisonedValueOf) throws' '(await $262.agent.getReportAsync()) resolves to the value "poisonedValueOf"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'poisonedToPrimitive', 'poisonedToPrimitive',
'Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive) throws' '(await $262.agent.getReportAsync()) resolves to the value "poisonedToPrimitive"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -19,7 +19,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
@ -39,8 +39,8 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, 0, 0, poisonedValueOf); Atomics.waitAsync(i32a, 0, 0, poisonedValueOf);
}, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive); Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive);
}, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws a Test262Error exception');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.waitasync esid: sec-atomics.waitasync
description: > description: >
Atomics.waitAsync returns a result object containing a promise that resolves to "ok" and async is true. Atomics.waitAsync returns a result object containing a property named "value" whose value is a promise that resolves to "ok" and async is true.
info: | info: |
Atomics.waitAsync( typedArray, index, value, timeout ) Atomics.waitAsync( typedArray, index, value, timeout )
@ -25,19 +25,23 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics, arrow-function] features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
); );
let {async, value} = Atomics.waitAsync(i32a, 0, 0, 1000); let {async, value} = Atomics.waitAsync(i32a, 0, 0, 1000);
assert.sameValue(async, true); assert.sameValue(async, true, 'The value of `async` is true');
assert(value instanceof Promise); assert(value instanceof Promise, 'The result of evaluating `(value instanceof Promise)` is true');
assert.sameValue(Object.getPrototypeOf(value), Promise.prototype); assert.sameValue(
Object.getPrototypeOf(value),
Promise.prototype,
'Object.getPrototypeOf(value) must return the value of Promise.prototype'
);
value.then(outcome => { value.then(outcome => {
assert.sameValue(outcome, "ok"); assert.sameValue(outcome, "ok", 'The value of `outcome` is "ok"');
}).then(() => $DONE(), $DONE); }).then(() => $DONE(), $DONE);
Atomics.add(i32a, 0, 1); Atomics.add(i32a, 0, 1);

View File

@ -23,22 +23,34 @@ info: |
Return _resultObject_. Return _resultObject_.
flags: [async] flags: [async]
includes: [atomicsHelper.js]
features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics, arrow-function] features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
); );
let {async, value} = Atomics.waitAsync(i32a, 0, 0, 1); let {async, value} = Atomics.waitAsync(i32a, 0, 0, 1);
assert.sameValue(async, true); let outcome = null;
assert(value instanceof Promise); let lifespan = 1000;
assert.sameValue(Object.getPrototypeOf(value), Promise.prototype); let start = $262.agent.monotonicNow();
value.then(outcome => { function wait() {
assert.sameValue(outcome, "timed-out"); let elapsed = $262.agent.monotonicNow() - start;
}).then(() => $DONE(), $DONE); if (elapsed > lifespan) {
$DONE("Test timed out");
return;
}
if (outcome === "timed-out") {
$DONE();
return;
}
$262.agent.setTimeout(wait, 0);
}
wait();
value.then(result => (outcome = result), $DONE);

View File

@ -24,7 +24,7 @@ info: |
features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics] features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
@ -32,5 +32,5 @@ const i32a = new Int32Array(
let {async, value} = Atomics.waitAsync(i32a, 0, 1); let {async, value} = Atomics.waitAsync(i32a, 0, 1);
assert.sameValue(async, false); assert.sameValue(async, false, 'The value of `async` is false');
assert.sameValue(value, "not-equal"); assert.sameValue(value, "not-equal", 'The value of `value` is "not-equal"');

View File

@ -24,7 +24,7 @@ info: |
features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics] features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8)
@ -32,5 +32,5 @@ const i32a = new Int32Array(
let {async, value} = Atomics.waitAsync(i32a, 0, 0, 0); let {async, value} = Atomics.waitAsync(i32a, 0, 0, 0);
assert.sameValue(async, false); assert.sameValue(async, false, 'The value of `async` is false');
assert.sameValue(value, "timed-out"); assert.sameValue(value, "timed-out", 'The value of `value` is "timed-out"');

View File

@ -33,7 +33,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -80,20 +80,20 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'A TypeError', 'A TypeError',
'Atomics.waitAsync(i32a, Symbol("1"), ..., ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'B TypeError', 'B TypeError',
'Atomics.waitAsync(i32a, Symbol("2"), ..., ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -31,7 +31,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
@ -51,18 +51,18 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf); Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf);
}, '`Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive); Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive);
}, '`Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, Symbol('1'), poisonedValueOf, poisonedValueOf); Atomics.waitAsync(i32a, Symbol('1'), poisonedValueOf, poisonedValueOf);
}, '`Atomics.waitAsync(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws TypeError'); }, '`Atomics.waitAsync(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, Symbol('2'), poisonedToPrimitive, poisonedToPrimitive); Atomics.waitAsync(i32a, Symbol('2'), poisonedToPrimitive, poisonedToPrimitive);
}, '`Atomics.waitAsync(i32a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws TypeError'); }, '`Atomics.waitAsync(i32a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws a TypeError exception');

View File

@ -20,7 +20,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -55,21 +55,21 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'A TypeError', 'A TypeError',
'Atomics.waitAsync(i32a, 0, 0, Symbol("1")) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'B TypeError', 'B TypeError',
'Atomics.waitAsync(i32a, 0, 0, Symbol("2")) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -18,7 +18,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -37,16 +37,16 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, 0, 0, poisonedValueOf); Atomics.waitAsync(i32a, 0, 0, poisonedValueOf);
}, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive); Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive);
}, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws a Test262Error exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, 0, 0, Symbol("foo")); Atomics.waitAsync(i32a, 0, 0, Symbol("foo"));
}, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws TypeError'); }, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, 0, 0, Symbol("foo")); Atomics.waitAsync(i32a, 0, 0, Symbol("foo"));
}, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws TypeError'); }, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws a TypeError exception');

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -71,21 +71,21 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'A TypeError', 'A TypeError',
'Atomics.waitAsync(i32a, 0, Symbol("1"), ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'B TypeError', 'B TypeError',
'Atomics.waitAsync(i32a, 0, Symbol("2"), ...) throws TypeError' '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ info: |
features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -41,16 +41,16 @@ const poisonedToPrimitive = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf); Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf);
}, '`Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception');
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive); Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive);
}, '`Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); }, '`Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf); Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf);
}, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf)` throws TypeError'); }, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf)` throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive); Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive);
}, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive)` throws TypeError'); }, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive)` throws a TypeError exception');

View File

@ -18,7 +18,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
@ -50,25 +50,25 @@ const i32a = new Int32Array(
); );
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'timed-out', 'timed-out',
'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' '(await $262.agent.getReportAsync()) resolves to the value "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -17,9 +17,10 @@ info: |
Boolean -> If argument is true, return 1. If argument is false, return +0. Boolean -> If argument is true, return 1. If argument is false, return +0.
flags: [async] flags: [async]
includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -36,12 +37,29 @@ const toPrimitive = {
} }
}; };
let outcomes = [];
let lifespan = 1000;
let start = $262.agent.monotonicNow();
(function wait() {
let elapsed = $262.agent.monotonicNow() - start;
if (elapsed > lifespan) {
$DONE("Test timed out");
return;
}
if (outcomes.length) {
assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"');
assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"');
assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"');
$DONE();
return;
}
$262.agent.setTimeout(wait, 0);
})();
Promise.all([ Promise.all([
Atomics.waitAsync(i32a, 0, 0, true).value, Atomics.waitAsync(i32a, 0, 0, true).value,
Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value,
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
]).then(outcomes => { ]).then(results => (outcomes = results), $DONE);
assert.sameValue(outcomes[0], 'timed-out');
assert.sameValue(outcomes[1], 'timed-out');
assert.sameValue(outcomes[2], 'timed-out');
}).then($DONE, $DONE);

View File

@ -22,7 +22,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const WAIT_INDEX = 0; const WAIT_INDEX = 0;
const RUNNING = 1; const RUNNING = 1;
@ -57,12 +57,12 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => {
assert.sameValue(agentCount, NUMAGENT); assert.sameValue(agentCount, NUMAGENT, 'The value of `agentCount` is expected to equal the value of NUMAGENT');
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT), Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT),
NOTIFYCOUNT, NOTIFYCOUNT,
'Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT'
); );
const reports = [ const reports = [

View File

@ -19,25 +19,13 @@ info: |
5.If q is NaN, let t be +, else let t be max(q, 0) 5.If q is NaN, let t be +, else let t be max(q, 0)
flags: [async] flags: [async]
includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
$262.agent.start(`
$262.agent.receiveBroadcast(async (sab) => {
var i32a = new Int32Array(sab);
$262.agent.sleep(1000);
Atomics.notify(i32a, 0, 4);
$262.agent.leaving();
});
`);
$262.agent.safeBroadcast(i32a);
const valueOf = { const valueOf = {
valueOf() { valueOf() {
return undefined; return undefined;
@ -54,10 +42,12 @@ Promise.all([
Atomics.waitAsync(i32a, 0, 0).value, Atomics.waitAsync(i32a, 0, 0).value,
Atomics.waitAsync(i32a, 0, 0, undefined).value, Atomics.waitAsync(i32a, 0, 0, undefined).value,
Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value,
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], 'ok'); assert.sameValue(outcomes[0], 'ok', 'The value of outcomes[0] is "ok"');
assert.sameValue(outcomes[1], 'ok'); assert.sameValue(outcomes[1], 'ok', 'The value of outcomes[1] is "ok"');
assert.sameValue(outcomes[2], 'ok'); assert.sameValue(outcomes[2], 'ok', 'The value of outcomes[2] is "ok"');
assert.sameValue(outcomes[3], 'ok'); assert.sameValue(outcomes[3], 'ok', 'The value of outcomes[3] is "ok"');
}).then($DONE, $DONE); }).then($DONE, $DONE);
Atomics.notify(i32a, 0);

View File

@ -26,7 +26,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const WAIT_INDEX = 0; const WAIT_INDEX = 0;
const RUNNING = 1; const RUNNING = 1;
@ -59,12 +59,12 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => {
assert.sameValue(agentCount, NUMAGENT); assert.sameValue(agentCount, NUMAGENT, 'The value of `agentCount` is expected to equal the value of NUMAGENT');
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT), Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT),
NOTIFYCOUNT, NOTIFYCOUNT,
'Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT'
); );
const reports = [ const reports = [

View File

@ -29,11 +29,11 @@ info: |
features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer] features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const index = { const index = {
valueOf() { valueOf() {
throw new Test262Error("index coerced"); throw new Test262Error();
} }
}; };
@ -46,5 +46,5 @@ for (const nonSharedArrayType of nonSharedArrayTypes) {
const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8)); const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8));
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(typedArray, index, 0, 0); Atomics.waitAsync(typedArray, index, 0, 0);
}); }, '`Atomics.waitAsync(typedArray, index, 0, 0)` throws a TypeError exception');
} }

View File

@ -29,11 +29,11 @@ info: |
features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer] features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const timeout = { const timeout = {
valueOf() { valueOf() {
throw new Test262Error("timeout coerced"); throw new Test262Error();
} }
}; };
@ -46,5 +46,5 @@ for (const nonSharedArrayType of nonSharedArrayTypes) {
const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8)); const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8));
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(typedArray, 0, 0, timeout); Atomics.waitAsync(typedArray, 0, 0, timeout);
}); }, '`Atomics.waitAsync(typedArray, 0, 0, timeout)` throws a TypeError exception');
} }

View File

@ -29,11 +29,11 @@ info: |
features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer] features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const value = { const value = {
valueOf() { valueOf() {
throw new Test262Error("value coerced"); throw new Test262Error();
} }
}; };
@ -46,5 +46,5 @@ for (const nonSharedArrayType of nonSharedArrayTypes) {
const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8)); const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8));
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.waitAsync(typedArray, 0, value, 0); Atomics.waitAsync(typedArray, 0, value, 0);
}); }, '`Atomics.waitAsync(typedArray, 0, value, 0)` throws a TypeError exception');
} }

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const value = 42; const value = 42;
@ -46,21 +46,21 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
value.toString(), '42',
'Atomics.store(i32a, 0, ${value}) returns 42' '(await $262.agent.getReportAsync()) resolves to the value "42"'
); );
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'not-equal', 'not-equal',
'Atomics.waitAsync(i32a, 0, 0).value resolves to "not-equal"' '(await $262.agent.getReportAsync()) resolves to the value "not-equal"'
); );
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0, 1), Atomics.notify(i32a, 0, 1),
0, 0,
'Atomics.notify(i32a, 0, 1) returns 0 (nothing to notify)' 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0, 1) must return 0'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -23,7 +23,7 @@ info: |
flags: [async] flags: [async]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, computed-property-names, Symbol, Symbol.toPrimitive, Atomics, arrow-function] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, computed-property-names, Symbol, Symbol.toPrimitive, Atomics, arrow-function]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const i32a = new Int32Array( const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
); );
@ -44,6 +44,6 @@ Promise.all([
Atomics.store(i32a, 0, 42), Atomics.store(i32a, 0, 42),
Atomics.waitAsync(i32a, 0, 0).value, Atomics.waitAsync(i32a, 0, 0).value,
]).then(outcomes => { ]).then(outcomes => {
assert.sameValue(outcomes[0], 42); assert.sameValue(outcomes[0], 42, 'The value of outcomes[0] is 42');
assert.sameValue(outcomes[1], 'not-equal'); assert.sameValue(outcomes[1], 'not-equal', 'The value of outcomes[1] is "not-equal"');
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const NUMAGENT = 2; const NUMAGENT = 2;
const RUNNING = 4; const RUNNING = 4;
@ -57,28 +57,28 @@ const i32a = new Int32Array(
$262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => {
assert.sameValue(agentCount, NUMAGENT); assert.sameValue(agentCount, NUMAGENT, 'The value of `agentCount` is expected to equal the value of NUMAGENT');
// Notify index 1, notifies nothing // Notify index 1, notifies nothing
assert.sameValue(Atomics.notify(i32a, 1), 0, 'Atomics.notify(i32a, 1) returns 0'); assert.sameValue(Atomics.notify(i32a, 1), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 1) must return 0');
// Notify index 3, notifies nothing // Notify index 3, notifies nothing
assert.sameValue(Atomics.notify(i32a, 3), 0, 'Atomics.notify(i32a, 3) returns 0'); assert.sameValue(Atomics.notify(i32a, 3), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 3) must return 0');
// Notify index 2, notifies 1 // Notify index 2, notifies 1
assert.sameValue(Atomics.notify(i32a, 2), 1, 'Atomics.notify(i32a, 2) returns 1'); assert.sameValue(Atomics.notify(i32a, 2), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 2) must return 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i32a, 0, 0, Infinity).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
// Notify index 0, notifies 1 // Notify index 0, notifies 1
assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 0) must return 1');
assert.sameValue( assert.sameValue(
await $262.agent.getReportAsync(), await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i32a, 2, 0, Infinity).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
}).then($DONE, $DONE); }).then($DONE, $DONE);

View File

@ -9,7 +9,7 @@ flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions]
---*/ ---*/
assert.sameValue(typeof Atomics.waitAsync, 'function'); assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
const RUNNING = 1; const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.huge; const TIMEOUT = $262.agent.timeouts.huge;
@ -35,22 +35,20 @@ $262.agent.start(`
$262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
assert.sameValue(agentCount, 1); assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1');
assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 1');
const lapse = await $262.agent.getReportAsync(); let lapse = await $262.agent.getReportAsync();
assert( assert(
lapse < TIMEOUT, lapse < TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of evaluating `(lapse < TIMEOUT)` is true'
); );
const result = await $262.agent.getReportAsync();
assert.sameValue( assert.sameValue(
result, await $262.agent.getReportAsync(),
'ok', 'ok',
'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "ok"' '(await $262.agent.getReportAsync()) resolves to the value "ok"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0');
}).then($DONE, $DONE); }).then($DONE, $DONE);