diff options
Diffstat (limited to 'test/built-ins/Atomics/load')
-rw-r--r-- | test/built-ins/Atomics/load/bad-range.js | 10 | ||||
-rw-r--r-- | test/built-ins/Atomics/load/good-views.js | 58 | ||||
-rw-r--r-- | test/built-ins/Atomics/load/non-views.js | 2 | ||||
-rw-r--r-- | test/built-ins/Atomics/load/nonshared-int-views.js | 4 | ||||
-rw-r--r-- | test/built-ins/Atomics/load/shared-nonint-views.js | 4 |
5 files changed, 39 insertions, 39 deletions
diff --git a/test/built-ins/Atomics/load/bad-range.js b/test/built-ins/Atomics/load/bad-range.js index 7f1c7afc7..d13ef4b5e 100644 --- a/test/built-ins/Atomics/load/bad-range.js +++ b/test/built-ins/Atomics/load/bad-range.js @@ -18,9 +18,9 @@ if (typeof BigInt !== "undefined") { } testWithTypedArrayConstructors(function(View) { - let view = new View(sab); - testWithAtomicsOutOfBoundsIndices(function(IdxGen) { - let Idx = IdxGen(view); - assert.throws(RangeError, () => Atomics.load(view, Idx)); - }); + let view = new View(sab); + testWithAtomicsOutOfBoundsIndices(function(IdxGen) { + let Idx = IdxGen(view); + assert.throws(RangeError, () => Atomics.load(view, Idx)); + }); }, views); diff --git a/test/built-ins/Atomics/load/good-views.js b/test/built-ins/Atomics/load/good-views.js index a4e2ad880..883cd5829 100644 --- a/test/built-ins/Atomics/load/good-views.js +++ b/test/built-ins/Atomics/load/good-views.js @@ -14,33 +14,33 @@ var ab = new ArrayBuffer(16); var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; testWithTypedArrayConstructors(function(View) { - // Make it interesting - use non-zero byteOffsets and non-zero indexes. - - var view = new View(sab, 32, 20); - var control = new View(ab, 0, 2); - - view[3] = -5; - control[0] = -5; - assert.sameValue(Atomics.load(view, 3), control[0], - "Result is subject to coercion"); - - control[0] = 12345; - view[3] = 12345; - assert.sameValue(Atomics.load(view, 3), control[0], - "Result is subject to chopping"); - - control[0] = 123456789; - view[3] = 123456789; - assert.sameValue(Atomics.load(view, 3), control[0], - "Result is subject to chopping"); - - // In-bounds boundary cases for indexing - testWithAtomicsInBoundsIndices(function(IdxGen) { - let Idx = IdxGen(view); - view.fill(0); - // Atomics.store() computes an index from Idx in the same way as other - // Atomics operations, not quite like view[Idx]. - Atomics.store(view, Idx, 37); - assert.sameValue(Atomics.load(view, Idx), 37); - }); + // Make it interesting - use non-zero byteOffsets and non-zero indexes. + + var view = new View(sab, 32, 20); + var control = new View(ab, 0, 2); + + view[3] = -5; + control[0] = -5; + assert.sameValue(Atomics.load(view, 3), control[0], + "Result is subject to coercion"); + + control[0] = 12345; + view[3] = 12345; + assert.sameValue(Atomics.load(view, 3), control[0], + "Result is subject to chopping"); + + control[0] = 123456789; + view[3] = 123456789; + assert.sameValue(Atomics.load(view, 3), control[0], + "Result is subject to chopping"); + + // In-bounds boundary cases for indexing + testWithAtomicsInBoundsIndices(function(IdxGen) { + let Idx = IdxGen(view); + view.fill(0); + // Atomics.store() computes an index from Idx in the same way as other + // Atomics operations, not quite like view[Idx]. + Atomics.store(view, Idx, 37); + assert.sameValue(Atomics.load(view, Idx), 37); + }); }, int_views); diff --git a/test/built-ins/Atomics/load/non-views.js b/test/built-ins/Atomics/load/non-views.js index 1c4442dbf..28739abbc 100644 --- a/test/built-ins/Atomics/load/non-views.js +++ b/test/built-ins/Atomics/load/non-views.js @@ -10,5 +10,5 @@ features: [SharedArrayBuffer, ArrayBuffer, DataView, Atomics, arrow-function, le ---*/ testWithAtomicsNonViewValues(function(view) { - assert.throws(TypeError, (() => Atomics.load(view, 0))); + assert.throws(TypeError, (() => Atomics.load(view, 0))); }); diff --git a/test/built-ins/Atomics/load/nonshared-int-views.js b/test/built-ins/Atomics/load/nonshared-int-views.js index 8442ce949..05eff959c 100644 --- a/test/built-ins/Atomics/load/nonshared-int-views.js +++ b/test/built-ins/Atomics/load/nonshared-int-views.js @@ -19,7 +19,7 @@ if (typeof BigInt !== "undefined") { } testWithTypedArrayConstructors(function(View) { - var view = new View(ab); + var view = new View(ab); - assert.throws(TypeError, (() => Atomics.load(view, 0))); + assert.throws(TypeError, (() => Atomics.load(view, 0))); }, int_views); diff --git a/test/built-ins/Atomics/load/shared-nonint-views.js b/test/built-ins/Atomics/load/shared-nonint-views.js index 726a618d0..20c33ba16 100644 --- a/test/built-ins/Atomics/load/shared-nonint-views.js +++ b/test/built-ins/Atomics/load/shared-nonint-views.js @@ -14,7 +14,7 @@ var sab = new SharedArrayBuffer(1024); var other_views = [Uint8ClampedArray, Float32Array, Float64Array]; testWithTypedArrayConstructors(function(View) { - var view = new View(sab); + var view = new View(sab); - assert.throws(TypeError, (() => Atomics.load(view, 0))); + assert.throws(TypeError, (() => Atomics.load(view, 0))); }, other_views); |