count-boundary-cases.js (1809B)
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics 2 // Copyright (C) 2017 Mozilla Corporation. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-atomics.notify 7 description: > 8 Allowed boundary cases for 'count' argument to Atomics.notify 9 info: | 10 Atomics.notify( typedArray, index, count ) 11 12 ... 13 3. If count is undefined, let c be +∞. 14 4. Else, 15 a. Let intCount be ? ToInteger(count). 16 ... 17 18 ToInteger ( argument ) 19 20 1. Let number be ? ToNumber(argument). 21 2. If number is NaN, return +0. 22 3. If number is +0, -0, +∞, or -∞, return number. 23 4. Return the number value that is the same sign as number 24 and whose magnitude is floor(abs(number)). 25 26 features: [Atomics, SharedArrayBuffer, TypedArray] 27 ---*/ 28 29 const i32a = new Int32Array( 30 new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) 31 ); 32 33 assert.sameValue( 34 Atomics.notify(i32a, 0, -3), 35 0, 36 'Atomics.notify(i32a, 0, -3) returns 0' 37 ); 38 assert.sameValue( 39 Atomics.notify(i32a, 0, Number.POSITIVE_INFINITY), 40 0, 41 'Atomics.notify(i32a, 0, Number.POSITIVE_INFINITY) returns 0' 42 ); 43 assert.sameValue( 44 Atomics.notify(i32a, 0, undefined), 45 0, 46 'Atomics.notify(i32a, 0, undefined) returns 0' 47 ); 48 assert.sameValue( 49 Atomics.notify(i32a, 0, '33'), 50 0, 51 'Atomics.notify(i32a, 0, \'33\') returns 0' 52 ); 53 assert.sameValue( 54 Atomics.notify(i32a, 0, { valueOf: 8 }), 55 0, 56 'Atomics.notify(i32a, 0, {valueOf: 8}) returns 0' 57 ); 58 assert.sameValue( 59 Atomics.notify(i32a, 0), 60 0, 61 'Atomics.notify(i32a, 0) returns 0' 62 ); 63 64 reportCompare(0, 0);