From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- ...fset-validated-against-initial-buffer-length.js | 46 +++ js/src/tests/test262/built-ins/DataView/name.js | 11 +- .../built-ins/DataView/prototype/buffer/length.js | 11 +- .../built-ins/DataView/prototype/buffer/name.js | 14 +- .../DataView/prototype/byteLength/length.js | 11 +- .../DataView/prototype/byteLength/name.js | 14 +- .../DataView/prototype/byteOffset/length.js | 11 +- .../DataView/prototype/byteOffset/name.js | 14 +- .../prototype/getBigInt64/not-a-constructor.js | 2 +- .../prototype/getBigUint64/not-a-constructor.js | 2 +- .../DataView/prototype/getFloat16/browser.js | 0 .../detached-buffer-after-toindex-byteoffset.js | 26 ++ ...detached-buffer-before-outofrange-byteoffset.js | 24 ++ .../prototype/getFloat16/detached-buffer.js | 21 ++ .../prototype/getFloat16/index-is-out-of-range.js | 63 ++++ .../DataView/prototype/getFloat16/length.js | 20 ++ .../DataView/prototype/getFloat16/minus-zero.js | 21 ++ .../DataView/prototype/getFloat16/name.js | 20 ++ .../getFloat16/negative-byteoffset-throws.js | 23 ++ .../prototype/getFloat16/not-a-constructor.js | 24 ++ .../prototype/getFloat16/resizable-buffer.js | 44 +++ ...eturn-abrupt-from-tonumber-byteoffset-symbol.js | 21 ++ .../return-abrupt-from-tonumber-byteoffset.js | 35 +++ .../prototype/getFloat16/return-infinity.js | 23 ++ .../DataView/prototype/getFloat16/return-nan.js | 23 ++ .../getFloat16/return-value-clean-arraybuffer.js | 26 ++ .../getFloat16/return-values-custom-offset.js | 29 ++ .../DataView/prototype/getFloat16/return-values.js | 40 +++ .../DataView/prototype/getFloat16/shell.js | 0 .../getFloat16/this-has-no-dataview-internal.js | 32 ++ .../prototype/getFloat16/this-is-not-object.js | 42 +++ .../getFloat16/to-boolean-littleendian.js | 31 ++ .../prototype/getFloat16/toindex-byteoffset.js | 53 ++++ .../DataView/prototype/getFloat32/length.js | 11 +- .../DataView/prototype/getFloat32/name.js | 11 +- .../prototype/getFloat32/not-a-constructor.js | 2 +- .../DataView/prototype/getFloat64/length.js | 11 +- .../DataView/prototype/getFloat64/name.js | 11 +- .../prototype/getFloat64/not-a-constructor.js | 2 +- .../DataView/prototype/getInt16/length.js | 11 +- .../built-ins/DataView/prototype/getInt16/name.js | 11 +- .../prototype/getInt16/not-a-constructor.js | 2 +- .../DataView/prototype/getInt32/length.js | 11 +- .../built-ins/DataView/prototype/getInt32/name.js | 11 +- .../prototype/getInt32/not-a-constructor.js | 2 +- .../built-ins/DataView/prototype/getInt8/length.js | 11 +- .../built-ins/DataView/prototype/getInt8/name.js | 11 +- .../prototype/getInt8/not-a-constructor.js | 2 +- .../DataView/prototype/getUint16/length.js | 11 +- .../built-ins/DataView/prototype/getUint16/name.js | 11 +- .../prototype/getUint16/not-a-constructor.js | 2 +- .../DataView/prototype/getUint32/length.js | 11 +- .../built-ins/DataView/prototype/getUint32/name.js | 11 +- .../prototype/getUint32/not-a-constructor.js | 2 +- .../DataView/prototype/getUint8/length.js | 11 +- .../built-ins/DataView/prototype/getUint8/name.js | 11 +- .../prototype/getUint8/not-a-constructor.js | 2 +- .../prototype/setBigInt64/not-a-constructor.js | 2 +- .../prototype/setBigUint64/not-a-constructor.js | 2 +- .../DataView/prototype/setFloat16/browser.js | 0 .../detached-buffer-after-number-value.js | 27 ++ .../detached-buffer-after-toindex-byteoffset.js | 26 ++ ...detached-buffer-before-outofrange-byteoffset.js | 24 ++ .../prototype/setFloat16/detached-buffer.js | 21 ++ .../index-check-before-value-conversion.js | 36 +++ .../prototype/setFloat16/index-is-out-of-range.js | 71 +++++ .../DataView/prototype/setFloat16/length.js | 20 ++ .../DataView/prototype/setFloat16/name.js | 20 ++ .../setFloat16/negative-byteoffset-throws.js | 25 ++ .../DataView/prototype/setFloat16/no-value-arg.js | 20 ++ .../prototype/setFloat16/not-a-constructor.js | 24 ++ .../range-check-after-value-conversion.js | 28 ++ .../prototype/setFloat16/resizable-buffer.js | 44 +++ ...eturn-abrupt-from-tonumber-byteoffset-symbol.js | 21 ++ .../return-abrupt-from-tonumber-byteoffset.js | 35 +++ .../return-abrupt-from-tonumber-value-symbol.js | 21 ++ .../return-abrupt-from-tonumber-value.js | 35 +++ .../setFloat16/set-values-little-endian-order.js | 25 ++ .../setFloat16/set-values-return-undefined.js | 36 +++ .../DataView/prototype/setFloat16/shell.js | 0 .../setFloat16/this-has-no-dataview-internal.js | 32 ++ .../prototype/setFloat16/this-is-not-object.js | 42 +++ .../setFloat16/to-boolean-littleendian.js | 37 +++ .../prototype/setFloat16/toindex-byteoffset.js | 99 ++++++ .../DataView/prototype/setFloat32/length.js | 11 +- .../DataView/prototype/setFloat32/name.js | 11 +- .../prototype/setFloat32/not-a-constructor.js | 2 +- .../DataView/prototype/setFloat64/length.js | 11 +- .../DataView/prototype/setFloat64/name.js | 11 +- .../prototype/setFloat64/not-a-constructor.js | 2 +- .../DataView/prototype/setInt16/length.js | 11 +- .../built-ins/DataView/prototype/setInt16/name.js | 11 +- .../prototype/setInt16/not-a-constructor.js | 2 +- .../DataView/prototype/setInt32/length.js | 11 +- .../built-ins/DataView/prototype/setInt32/name.js | 11 +- .../prototype/setInt32/not-a-constructor.js | 2 +- .../built-ins/DataView/prototype/setInt8/length.js | 11 +- .../built-ins/DataView/prototype/setInt8/name.js | 11 +- .../prototype/setInt8/not-a-constructor.js | 2 +- .../DataView/prototype/setUint16/length.js | 11 +- .../built-ins/DataView/prototype/setUint16/name.js | 11 +- .../prototype/setUint16/not-a-constructor.js | 2 +- .../DataView/prototype/setUint32/length.js | 11 +- .../built-ins/DataView/prototype/setUint32/name.js | 11 +- .../prototype/setUint32/not-a-constructor.js | 2 +- .../DataView/prototype/setUint8/length.js | 11 +- .../built-ins/DataView/prototype/setUint8/name.js | 11 +- .../prototype/setUint8/not-a-constructor.js | 2 +- js/src/tests/test262/built-ins/DataView/shell.js | 347 +++++++++++++++------ 109 files changed, 1966 insertions(+), 315 deletions(-) create mode 100644 js/src/tests/test262/built-ins/DataView/byteOffset-validated-against-initial-buffer-length.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/browser.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-after-toindex-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-before-outofrange-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/index-is-out-of-range.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/length.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/minus-zero.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/name.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/negative-byteoffset-throws.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/resizable-buffer.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-infinity.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-nan.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-value-clean-arraybuffer.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values-custom-offset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/shell.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-has-no-dataview-internal.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-is-not-object.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/to-boolean-littleendian.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/getFloat16/toindex-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/browser.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-number-value.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-toindex-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-before-outofrange-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-check-before-value-conversion.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-is-out-of-range.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/length.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/name.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/negative-byteoffset-throws.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/no-value-arg.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/range-check-after-value-conversion.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/resizable-buffer.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value-symbol.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-little-endian-order.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-return-undefined.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/shell.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-has-no-dataview-internal.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-is-not-object.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/to-boolean-littleendian.js create mode 100644 js/src/tests/test262/built-ins/DataView/prototype/setFloat16/toindex-byteoffset.js (limited to 'js/src/tests/test262/built-ins/DataView') diff --git a/js/src/tests/test262/built-ins/DataView/byteOffset-validated-against-initial-buffer-length.js b/js/src/tests/test262/built-ins/DataView/byteOffset-validated-against-initial-buffer-length.js new file mode 100644 index 0000000000..51b030b66b --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/byteOffset-validated-against-initial-buffer-length.js @@ -0,0 +1,46 @@ +// Copyright (C) 2024 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview-buffer-byteoffset-bytelength +description: > + The byteOffset argument is validated against the initial buffer length. +info: | + DataView ( buffer [ , byteOffset [ , byteLength ] ] ) + + ... + 3. Let offset be ? ToIndex(byteOffset). + ... + 5. Let bufferByteLength be ArrayBufferByteLength(buffer, seq-cst). + 6. If offset > bufferByteLength, throw a RangeError exception. + ... + 10. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%DataView.prototype%", + « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »). + ... + + OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] ) + + ... + 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto). + ... + +features: [Reflect.construct] +---*/ + +let newTarget = Object.defineProperty(function(){}.bind(), "prototype", { + get() { + throw new Test262Error("GetPrototypeFromConstructor not executed"); + } +}); + +// Zero length buffer. +let ab = new ArrayBuffer(0); + +// Byte offset is larger than the buffer length, which is zero. +let byteOffset = 10; + +assert.throws(RangeError, () => { + Reflect.construct(DataView, [ab, byteOffset], newTarget); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/name.js b/js/src/tests/test262/built-ins/DataView/name.js index 2b1e1c74bd..da2852d9f8 100644 --- a/js/src/tests/test262/built-ins/DataView/name.js +++ b/js/src/tests/test262/built-ins/DataView/name.js @@ -8,10 +8,11 @@ description: > includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.name, "DataView", "The value of `DataView.name` is `'DataView'`"); - -verifyNotEnumerable(DataView, "name"); -verifyNotWritable(DataView, "name"); -verifyConfigurable(DataView, "name"); +verifyProperty(DataView, "name", { + value: "DataView", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/buffer/length.js b/js/src/tests/test262/built-ins/DataView/prototype/buffer/length.js index 826ab9e259..6d49bd8107 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/buffer/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/buffer/length.js @@ -24,10 +24,11 @@ includes: [propertyHelper.js] var desc = Object.getOwnPropertyDescriptor(DataView.prototype, "buffer"); -assert.sameValue(desc.get.length, 0); - -verifyNotEnumerable(desc.get, "length"); -verifyNotWritable(desc.get, "length"); -verifyConfigurable(desc.get, "length"); +verifyProperty(desc.get, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/buffer/name.js b/js/src/tests/test262/built-ins/DataView/prototype/buffer/name.js index 6721b00274..62460653b2 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/buffer/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/buffer/name.js @@ -17,13 +17,11 @@ var descriptor = Object.getOwnPropertyDescriptor( DataView.prototype, 'buffer' ); -assert.sameValue( - descriptor.get.name, 'get buffer', - 'The value of `descriptor.get.name` is `"get buffer"`' -); - -verifyNotEnumerable(descriptor.get, 'name'); -verifyNotWritable(descriptor.get, 'name'); -verifyConfigurable(descriptor.get, 'name'); +verifyProperty(descriptor.get, "name", { + value: "get buffer", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/byteLength/length.js b/js/src/tests/test262/built-ins/DataView/prototype/byteLength/length.js index 85dd54adcf..94a56f8fb4 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/byteLength/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/byteLength/length.js @@ -24,10 +24,11 @@ includes: [propertyHelper.js] var desc = Object.getOwnPropertyDescriptor(DataView.prototype, "byteLength"); -assert.sameValue(desc.get.length, 0); - -verifyNotEnumerable(desc.get, "length"); -verifyNotWritable(desc.get, "length"); -verifyConfigurable(desc.get, "length"); +verifyProperty(desc.get, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/byteLength/name.js b/js/src/tests/test262/built-ins/DataView/prototype/byteLength/name.js index b437bd7173..5dee2ae780 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/byteLength/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/byteLength/name.js @@ -17,13 +17,11 @@ var descriptor = Object.getOwnPropertyDescriptor( DataView.prototype, 'byteLength' ); -assert.sameValue( - descriptor.get.name, 'get byteLength', - 'The value of `descriptor.get.name` is `"get byteLength"`' -); - -verifyNotEnumerable(descriptor.get, 'name'); -verifyNotWritable(descriptor.get, 'name'); -verifyConfigurable(descriptor.get, 'name'); +verifyProperty(descriptor.get, "name", { + value: "get byteLength", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/length.js b/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/length.js index 6565d89280..b6ed091883 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/length.js @@ -24,10 +24,11 @@ includes: [propertyHelper.js] var desc = Object.getOwnPropertyDescriptor(DataView.prototype, "byteOffset"); -assert.sameValue(desc.get.length, 0); - -verifyNotEnumerable(desc.get, "length"); -verifyNotWritable(desc.get, "length"); -verifyConfigurable(desc.get, "length"); +verifyProperty(desc.get, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/name.js b/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/name.js index e77dc91d09..f4e24e3bc3 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/byteOffset/name.js @@ -17,13 +17,11 @@ var descriptor = Object.getOwnPropertyDescriptor( DataView.prototype, 'byteOffset' ); -assert.sameValue( - descriptor.get.name, 'get byteOffset', - 'The value of `descriptor.get.name` is `"get byteOffset"`' -); - -verifyNotEnumerable(descriptor.get, 'name'); -verifyNotWritable(descriptor.get, 'name'); -verifyConfigurable(descriptor.get, 'name'); +verifyProperty(descriptor.get, "name", { + value: "get byteOffset", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getBigInt64/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getBigInt64/not-a-constructor.js index 20cb228a77..d6a83eb7fd 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getBigInt64/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getBigInt64/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getBigInt64(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getBigInt64(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getBigUint64/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getBigUint64/not-a-constructor.js index c9a26de1fa..d310d4ea5c 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getBigUint64/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getBigUint64/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getBigUint64(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getBigUint64(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/browser.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-after-toindex-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-after-toindex-byteoffset.js new file mode 100644 index 0000000000..58d6f5547b --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-after-toindex-byteoffset.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Detached buffer is only checked after ToIndex(requestIndex) +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var buffer = new ArrayBuffer(6); +var sample = new DataView(buffer, 0); + +$DETACHBUFFER(buffer); + +assert.throws(RangeError, function() { + sample.getFloat16(-1); +}); + +assert.throws(RangeError, function() { + sample.getFloat16(Infinity); +}, "Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-before-outofrange-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-before-outofrange-byteoffset.js new file mode 100644 index 0000000000..07c76080e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer-before-outofrange-byteoffset.js @@ -0,0 +1,24 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Detached buffer is checked before out of range byteOffset's value +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var sample; +var buffer = new ArrayBuffer(12); + +sample = new DataView(buffer, 0); + +$DETACHBUFFER(buffer); + +assert.throws(TypeError, function() { + sample.getFloat16(13); +}, "13"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer.js new file mode 100644 index 0000000000..f7c59cb29c --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/detached-buffer.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Throws a TypeError if buffer is detached +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var buffer = new ArrayBuffer(1); +var sample = new DataView(buffer, 0); + +$DETACHBUFFER(buffer); +assert.throws(TypeError, function() { + sample.getFloat16(0); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/index-is-out-of-range.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/index-is-out-of-range.js new file mode 100644 index 0000000000..7781bde810 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/index-is-out-of-range.js @@ -0,0 +1,63 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Throws a RangeError if getIndex + elementSize > viewSize +features: [Float16Array] +---*/ + +var sample; +var buffer = new ArrayBuffer(12); + +sample = new DataView(buffer, 0); + +assert.throws(RangeError, function() { + sample.getFloat16(Infinity); +}, "getIndex == Infinity"); + +assert.throws(RangeError, function() { + sample.getFloat16(13); +}, "13 + 2 > 12"); + +assert.throws(RangeError, function() { + sample.getFloat16(12); +}, "12 + 2 > 12"); + +assert.throws(RangeError, function() { + sample.getFloat16(11); +}, "11 + 2 > 12"); + +sample = new DataView(buffer, 10); +assert.throws(RangeError, function() { + sample.getFloat16(1); +}, "1 + 2 > 2 (offset)"); + +sample = new DataView(buffer, 11); +assert.throws(RangeError, function() { + sample.getFloat16(0); +}, "0 + 2 > 1 (offset)"); + +sample = new DataView(buffer, 0, 2); +assert.throws(RangeError, function() { + sample.getFloat16(1); +}, "1 + 2 > 2 (length)"); + +sample = new DataView(buffer, 0, 1); +assert.throws(RangeError, function() { + sample.getFloat16(0); +}, "0 + 2 > 1 (length)"); + +sample = new DataView(buffer, 4, 2); +assert.throws(RangeError, function() { + sample.getFloat16(1); +}, "1 + 2 > 2 (offset+length)"); + +sample = new DataView(buffer, 4, 1); +assert.throws(RangeError, function() { + sample.getFloat16(0); +}, "0 + 2 > 1 (offset+length)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/length.js new file mode 100644 index 0000000000..bd71c6cbda --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/length.js @@ -0,0 +1,20 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + DataView.prototype.getFloat16.length is 1. +features: [Float16Array] +includes: [propertyHelper.js] +---*/ + +verifyProperty(DataView.prototype.getFloat16, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/minus-zero.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/minus-zero.js new file mode 100644 index 0000000000..2279538fd7 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/minus-zero.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return -0 +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +sample.setUint8(0, 128); +sample.setUint8(1, 0); + +var result = sample.getFloat16(0); +assert.sameValue(result, -0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/name.js new file mode 100644 index 0000000000..df100772a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/name.js @@ -0,0 +1,20 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + DataView.prototype.getFloat16.name is "getFloat16". +features: [Float16Array] +includes: [propertyHelper.js] +---*/ + +verifyProperty(DataView.prototype.getFloat16, "name", { + value: "getFloat16", + writable: false, + enumerable: false, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/negative-byteoffset-throws.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/negative-byteoffset-throws.js new file mode 100644 index 0000000000..ada6286fd5 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/negative-byteoffset-throws.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Throws a RangeError if ToInteger(byteOffset) < 0 +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(12); +var sample = new DataView(buffer, 0); + +assert.throws(RangeError, function() { + sample.getFloat16(-1); +}, "-1"); + +assert.throws(RangeError, function() { + sample.getFloat16(-Infinity); +}, "-Infinity"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/not-a-constructor.js new file mode 100644 index 0000000000..af811a5e30 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/not-a-constructor.js @@ -0,0 +1,24 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + DataView.prototype.getFloat16 does not implement [[Construct]], is not new-able +includes: [isConstructor.js] +features: [Float16Array, Reflect.construct, DataView, arrow-function, ArrayBuffer] +---*/ + +assert.sameValue( + isConstructor(DataView.prototype.getFloat16), + false, + 'isConstructor(DataView.prototype.getFloat16) must return false' +); + +assert.throws(TypeError, () => { + let dv = new DataView(new ArrayBuffer(16)); new dv.getFloat16(0, 0); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/resizable-buffer.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/resizable-buffer.js new file mode 100644 index 0000000000..ef1bbcdb4e --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/resizable-buffer.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-arraybuffer-resizable) shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- Float16Array,resizable-arraybuffer is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-dataview.prototype.getfloat16 +description: Throws a TypeError if buffer is out-of-bounds +features: [Float16Array, DataView, ArrayBuffer, resizable-arraybuffer] +---*/ + +assert.sameValue( + typeof ArrayBuffer.prototype.resize, + 'function', + 'implements ArrayBuffer.prototype.resize' +); + +var buffer = new ArrayBuffer(24, {maxByteLength: 32}); +var sample = new DataView(buffer, 0, 16); + +try { + buffer.resize(32); +} catch (_) {} + +assert.sameValue(sample.getFloat16(0), 0, 'following grow'); + +try { + buffer.resize(16); +} catch (_) {} + +assert.sameValue(sample.getFloat16(0), 0, 'following shrink (within bounds)'); + +var expectedError; +try { + buffer.resize(8); + expectedError = TypeError; +} catch (_) { + expectedError = Test262Error; +} + +assert.throws(expectedError, function() { + sample.getFloat16(0); + throw new Test262Error('the operation completed successfully'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js new file mode 100644 index 0000000000..1643b832b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return abrupt from ToNumber(symbol byteOffset) +features: [Float16Array, Symbol] +---*/ + +var buffer = new ArrayBuffer(1); +var sample = new DataView(buffer, 0); + +var s = Symbol("1"); + +assert.throws(TypeError, function() { + sample.getFloat16(s); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset.js new file mode 100644 index 0000000000..1c5088df49 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-abrupt-from-tonumber-byteoffset.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return abrupt from ToNumber(byteOffset) +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(1); +var sample = new DataView(buffer, 0); + +var bo1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var bo2 = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + sample.getFloat16(bo1); +}, "valueOf"); + +assert.throws(Test262Error, function() { + sample.getFloat16(bo2); +}, "toString"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-infinity.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-infinity.js new file mode 100644 index 0000000000..26c0fcecd8 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-infinity.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return Infinity values +features: [Float16Array, DataView.prototype.setUint8] +---*/ + +var buffer = new ArrayBuffer(4); +var sample = new DataView(buffer, 0); + +sample.setUint8(0, 124); // 0b01111100 +sample.setUint8(1, 0); +sample.setUint8(2, 252); // 0b11111100 +sample.setUint8(3, 0); + +assert.sameValue(sample.getFloat16(0), Infinity); +assert.sameValue(sample.getFloat16(2), -Infinity); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-nan.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-nan.js new file mode 100644 index 0000000000..56af38b203 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-nan.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return NaN values +features: [Float16Array, DataView.prototype.setUint8] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +sample.setUint8(0, 126); // 0b01111110 +sample.setUint8(1, 0); +sample.setUint8(2, 254); // 0b11111110 +sample.setUint8(3, 0); + +assert.sameValue(sample.getFloat16(0), NaN); +assert.sameValue(sample.getFloat16(2), NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-value-clean-arraybuffer.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-value-clean-arraybuffer.js new file mode 100644 index 0000000000..bf8b2b0685 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-value-clean-arraybuffer.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return value from Buffer using a clean ArrayBuffer +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +assert.sameValue(sample.getFloat16(0, true), 0, "sample.getFloat16(0, true)"); +assert.sameValue(sample.getFloat16(1, true), 0, "sample.getFloat16(1, true)"); +assert.sameValue(sample.getFloat16(2, true), 0, "sample.getFloat16(2, true)"); +assert.sameValue(sample.getFloat16(3, true), 0, "sample.getFloat16(3, true)"); +assert.sameValue(sample.getFloat16(4, true), 0, "sample.getFloat16(4, true)"); +assert.sameValue(sample.getFloat16(0, false), 0, "sample.getFloat16(0, false)"); +assert.sameValue(sample.getFloat16(1, false), 0, "sample.getFloat16(1, false)"); +assert.sameValue(sample.getFloat16(2, false), 0, "sample.getFloat16(2, false)"); +assert.sameValue(sample.getFloat16(3, false), 0, "sample.getFloat16(3, false)"); +assert.sameValue(sample.getFloat16(4, false), 0, "sample.getFloat16(4, false)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values-custom-offset.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values-custom-offset.js new file mode 100644 index 0000000000..c121bd316c --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values-custom-offset.js @@ -0,0 +1,29 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return values from Buffer using a custom offset +features: [Float16Array, DataView.prototype.setUint8] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +sample.setUint8(4, 75); // 01001011 +sample.setUint8(5, 75); // 01001011 +sample.setUint8(6, 76); // 01001100 +sample.setUint8(7, 77); // 01001101 + +sample = new DataView(buffer, 4); + +assert.sameValue(sample.getFloat16(0, false), 14.5859375, "0, false"); // 01001011 01001011 +assert.sameValue(sample.getFloat16(1, false), 14.59375, "1, false"); // 01001011 01001100 +assert.sameValue(sample.getFloat16(2, false), 17.203125, "2, false"); // 01001100 01001101 +assert.sameValue(sample.getFloat16(0, true), 14.5859375, "0, true"); // 01001011 01001011 +assert.sameValue(sample.getFloat16(1, true), 17.171875, "1, true"); // 01001100 01001011 +assert.sameValue(sample.getFloat16(2, true), 21.1875, "2, true"); // 01001101 01001100 + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values.js new file mode 100644 index 0000000000..51b3b874cd --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/return-values.js @@ -0,0 +1,40 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Return values from Buffer +features: [Float16Array, DataView.prototype.setUint8] +---*/ + +var buffer = new ArrayBuffer(4); +var sample = new DataView(buffer, 0); + +sample.setUint8(0, 66); // 01000010 +sample.setUint8(1, 40); // 00101000 +sample.setUint8(2, 64); // 01000000 +sample.setUint8(3, 224); // 11100000 + +assert.sameValue(sample.getFloat16(0, false), 3.078125, "0, false"); // 01000010 00101000 +assert.sameValue(sample.getFloat16(1, false), 0.033203125, "1, false"); // 00101000 01000000 +assert.sameValue(sample.getFloat16(2, false), 2.4375, "2, false"); // 01000000 11100000 + +assert.sameValue(sample.getFloat16(0, true), 0.03326416015625, "0, true"); // 00101000 01000010 +assert.sameValue(sample.getFloat16(1, true), 2.078125, "1, true"); // 01000000 00101000 +assert.sameValue(sample.getFloat16(2, true), -544, "2, true"); // 11100000 01000000 + +sample.setUint8(0, 75); // 01001011 +sample.setUint8(1, 75); // 01001011 +sample.setUint8(2, 76); // 01001100 +sample.setUint8(3, 76); // 01001101 + +assert.sameValue(sample.getFloat16(0, false), 14.5859375, "0, false"); // 01001011 01001011 +assert.sameValue(sample.getFloat16(1, false), 14.59375, "1, false"); // 01001011 01001100 +assert.sameValue(sample.getFloat16(2, false), 17.1875, "2, false"); // 01001100 01001101 +assert.sameValue(sample.getFloat16(0, true), 14.5859375, "0, true"); // 01001011 01001011 +assert.sameValue(sample.getFloat16(1, true), 17.171875, "1, true"); // 01001100 01001011 +assert.sameValue(sample.getFloat16(2, true), 17.1875, "2, true"); // 01001100 01001101 + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/shell.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-has-no-dataview-internal.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-has-no-dataview-internal.js new file mode 100644 index 0000000000..3b77b7f5b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-has-no-dataview-internal.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Throws a TypeError if this does not have a [[DataView]] internal slot +features: [Float16Array, Int8Array] +---*/ + +var getFloat16 = DataView.prototype.getFloat16; + +assert.throws(TypeError, function() { + getFloat16.call({}); +}, "{}"); + +assert.throws(TypeError, function() { + getFloat16.call([]); +}, "[]"); + +var ab = new ArrayBuffer(1); +assert.throws(TypeError, function() { + getFloat16.call(ab); +}, "ArrayBuffer"); + +var ta = new Int8Array(); +assert.throws(TypeError, function() { + getFloat16.call(ta); +}, "TypedArray"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-is-not-object.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-is-not-object.js new file mode 100644 index 0000000000..917dc61dc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/this-is-not-object.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: Throws a TypeError if this is not Object +features: [Float16Array, Symbol] +---*/ + +var getFloat16 = DataView.prototype.getFloat16; + +assert.throws(TypeError, function() { + getFloat16.call(undefined); +}, "undefined"); + +assert.throws(TypeError, function() { + getFloat16.call(null); +}, "null"); + +assert.throws(TypeError, function() { + getFloat16.call(1); +}, "1"); + +assert.throws(TypeError, function() { + getFloat16.call("string"); +}, "string"); + +assert.throws(TypeError, function() { + getFloat16.call(true); +}, "true"); + +assert.throws(TypeError, function() { + getFloat16.call(false); +}, "false"); + +var s = Symbol("1"); +assert.throws(TypeError, function() { + getFloat16.call(s); +}, "symbol"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/to-boolean-littleendian.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/to-boolean-littleendian.js new file mode 100644 index 0000000000..793f95477c --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/to-boolean-littleendian.js @@ -0,0 +1,31 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getfloat16 +description: > + Boolean littleEndian argument coerced in ToBoolean +features: [Float16Array, DataView.prototype.setUint8, Symbol] +---*/ + +var buffer = new ArrayBuffer(2); +var sample = new DataView(buffer, 0); + +sample.setUint8(0, 75); +sample.setUint8(1, 76); + +// False +assert.sameValue(sample.getFloat16(0), 14.59375, "no arg"); +assert.sameValue(sample.getFloat16(0, undefined), 14.59375, "undefined"); +assert.sameValue(sample.getFloat16(0, null), 14.59375, "null"); +assert.sameValue(sample.getFloat16(0, 0), 14.59375, "0"); +assert.sameValue(sample.getFloat16(0, ""), 14.59375, "the empty string"); + +// True +assert.sameValue(sample.getFloat16(0, {}), 17.171875, "{}"); +assert.sameValue(sample.getFloat16(0, Symbol("1")), 17.171875, "symbol"); +assert.sameValue(sample.getFloat16(0, 1), 17.171875, "1"); +assert.sameValue(sample.getFloat16(0, "string"), 17.171875, "string"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/toindex-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/toindex-byteoffset.js new file mode 100644 index 0000000000..ae51364d35 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat16/toindex-byteoffset.js @@ -0,0 +1,53 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.getFloat16 +description: > + ToIndex conversions on byteOffset +features: [Float16Array, DataView.prototype.setUint8] +---*/ + +var buffer = new ArrayBuffer(6); +var sample = new DataView(buffer, 0); + +sample.setUint8(0, 75); +sample.setUint8(1, 76); +sample.setUint8(2, 77); +sample.setUint8(3, 78); +sample.setUint8(4, 79); +sample.setUint8(5, 80); + +var obj1 = { + valueOf: function() { + return 3; + } +}; + +var obj2 = { + toString: function() { + return 2; + } +}; + +assert.sameValue(sample.getFloat16(-0), 14.59375, "-0"); +assert.sameValue(sample.getFloat16(obj1), 25.234375, "object's valueOf"); +assert.sameValue(sample.getFloat16(obj2), 21.21875, "object's toString"); +assert.sameValue(sample.getFloat16(""), 14.59375, "the Empty string"); +assert.sameValue(sample.getFloat16("0"), 14.59375, "string '0'"); +assert.sameValue(sample.getFloat16("2"), 21.21875, "string '2'"); +assert.sameValue(sample.getFloat16(true), 17.203125, "true"); +assert.sameValue(sample.getFloat16(false), 14.59375, "false"); +assert.sameValue(sample.getFloat16(NaN), 14.59375, "NaN"); +assert.sameValue(sample.getFloat16(null), 14.59375, "null"); +assert.sameValue(sample.getFloat16(0.1), 14.59375, "0.1"); +assert.sameValue(sample.getFloat16(0.9), 14.59375, "0.9"); +assert.sameValue(sample.getFloat16(1.1), 17.203125, "1.1"); +assert.sameValue(sample.getFloat16(1.9), 17.203125, "1.9"); +assert.sameValue(sample.getFloat16(-0.1), 14.59375, "-0.1"); +assert.sameValue(sample.getFloat16(-0.99999), 14.59375, "-0.99999"); +assert.sameValue(sample.getFloat16(undefined), 14.59375, "undefined"); +assert.sameValue(sample.getFloat16(), 14.59375, "no arg"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/length.js index 8f1256a67b..c05fb88469 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getFloat32.length, 1); - -verifyNotEnumerable(DataView.prototype.getFloat32, "length"); -verifyNotWritable(DataView.prototype.getFloat32, "length"); -verifyConfigurable(DataView.prototype.getFloat32, "length"); +verifyProperty(DataView.prototype.getFloat32, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/name.js index 26e5b6d3e0..1feabf5047 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getFloat32.name, "getFloat32"); - -verifyNotEnumerable(DataView.prototype.getFloat32, "name"); -verifyNotWritable(DataView.prototype.getFloat32, "name"); -verifyConfigurable(DataView.prototype.getFloat32, "name"); +verifyProperty(DataView.prototype.getFloat32, "name", { + value: "getFloat32", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/not-a-constructor.js index 628d35ed6d..cb2eef1326 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat32/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getFloat32(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getFloat32(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/length.js index 3a2a4d7fcf..d8082606bc 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getFloat64.length, 1); - -verifyNotEnumerable(DataView.prototype.getFloat64, "length"); -verifyNotWritable(DataView.prototype.getFloat64, "length"); -verifyConfigurable(DataView.prototype.getFloat64, "length"); +verifyProperty(DataView.prototype.getFloat64, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/name.js index 2ae4d6ebae..020a27ccbc 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getFloat64.name, "getFloat64"); - -verifyNotEnumerable(DataView.prototype.getFloat64, "name"); -verifyNotWritable(DataView.prototype.getFloat64, "name"); -verifyConfigurable(DataView.prototype.getFloat64, "name"); +verifyProperty(DataView.prototype.getFloat64, "name", { + value: "getFloat64", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/not-a-constructor.js index 551e9935fa..1bdeebec4a 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getFloat64/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getFloat64(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getFloat64(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt16/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt16/length.js index c3b2db9ee3..493574f48d 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt16/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt16/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getInt16.length, 1); - -verifyNotEnumerable(DataView.prototype.getInt16, "length"); -verifyNotWritable(DataView.prototype.getInt16, "length"); -verifyConfigurable(DataView.prototype.getInt16, "length"); +verifyProperty(DataView.prototype.getInt16, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt16/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt16/name.js index 933b5b3ddf..c054c266cc 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt16/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt16/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getInt16.name, "getInt16"); - -verifyNotEnumerable(DataView.prototype.getInt16, "name"); -verifyNotWritable(DataView.prototype.getInt16, "name"); -verifyConfigurable(DataView.prototype.getInt16, "name"); +verifyProperty(DataView.prototype.getInt16, "name", { + value: "getInt16", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt16/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt16/not-a-constructor.js index f4a3a72970..3e720ea085 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt16/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt16/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getInt16(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getInt16(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt32/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt32/length.js index 746487b54a..7482320415 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt32/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt32/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getInt32.length, 1); - -verifyNotEnumerable(DataView.prototype.getInt32, "length"); -verifyNotWritable(DataView.prototype.getInt32, "length"); -verifyConfigurable(DataView.prototype.getInt32, "length"); +verifyProperty(DataView.prototype.getInt32, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt32/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt32/name.js index 7c44bd6960..48b4d515e2 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt32/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt32/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getInt32.name, "getInt32"); - -verifyNotEnumerable(DataView.prototype.getInt32, "name"); -verifyNotWritable(DataView.prototype.getInt32, "name"); -verifyConfigurable(DataView.prototype.getInt32, "name"); +verifyProperty(DataView.prototype.getInt32, "name", { + value: "getInt32", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt32/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt32/not-a-constructor.js index 2e987dc405..6710a816dd 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt32/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt32/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getInt32(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getInt32(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt8/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt8/length.js index 7ad4e7999c..b9ec2cc2dd 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt8/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt8/length.js @@ -22,10 +22,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getInt8.length, 1); - -verifyNotEnumerable(DataView.prototype.getInt8, "length"); -verifyNotWritable(DataView.prototype.getInt8, "length"); -verifyConfigurable(DataView.prototype.getInt8, "length"); +verifyProperty(DataView.prototype.getInt8, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt8/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt8/name.js index 4e56fcf221..e56be1d203 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt8/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt8/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getInt8.name, "getInt8"); - -verifyNotEnumerable(DataView.prototype.getInt8, "name"); -verifyNotWritable(DataView.prototype.getInt8, "name"); -verifyConfigurable(DataView.prototype.getInt8, "name"); +verifyProperty(DataView.prototype.getInt8, "name", { + value: "getInt8", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getInt8/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getInt8/not-a-constructor.js index 8acdd1a409..48e5a88efe 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getInt8/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getInt8/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getInt8(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getInt8(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint16/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint16/length.js index 3403612bf9..19633b33fe 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint16/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint16/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getUint16.length, 1); - -verifyNotEnumerable(DataView.prototype.getUint16, "length"); -verifyNotWritable(DataView.prototype.getUint16, "length"); -verifyConfigurable(DataView.prototype.getUint16, "length"); +verifyProperty(DataView.prototype.getUint16, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint16/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint16/name.js index 3c39801e23..54cfb46a1d 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint16/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint16/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getUint16.name, "getUint16"); - -verifyNotEnumerable(DataView.prototype.getUint16, "name"); -verifyNotWritable(DataView.prototype.getUint16, "name"); -verifyConfigurable(DataView.prototype.getUint16, "name"); +verifyProperty(DataView.prototype.getUint16, "name", { + value: "getUint16", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint16/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint16/not-a-constructor.js index c56587ca00..06c27fb236 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint16/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint16/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getUint16(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getUint16(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint32/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint32/length.js index 5ca99f56e8..544ffc4536 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint32/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint32/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getUint32.length, 1); - -verifyNotEnumerable(DataView.prototype.getUint32, "length"); -verifyNotWritable(DataView.prototype.getUint32, "length"); -verifyConfigurable(DataView.prototype.getUint32, "length"); +verifyProperty(DataView.prototype.getUint32, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint32/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint32/name.js index 9e5f2f2a5c..259d024dc4 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint32/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint32/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getUint32.name, "getUint32"); - -verifyNotEnumerable(DataView.prototype.getUint32, "name"); -verifyNotWritable(DataView.prototype.getUint32, "name"); -verifyConfigurable(DataView.prototype.getUint32, "name"); +verifyProperty(DataView.prototype.getUint32, "name", { + value: "getUint32", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint32/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint32/not-a-constructor.js index 423a22224f..a3b3c483b6 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint32/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint32/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getUint32(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getUint32(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint8/length.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint8/length.js index aaa458a70e..fd67db7453 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint8/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint8/length.js @@ -22,10 +22,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getUint8.length, 1); - -verifyNotEnumerable(DataView.prototype.getUint8, "length"); -verifyNotWritable(DataView.prototype.getUint8, "length"); -verifyConfigurable(DataView.prototype.getUint8, "length"); +verifyProperty(DataView.prototype.getUint8, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint8/name.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint8/name.js index 071782c08f..1fd1de4e03 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint8/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint8/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.getUint8.name, "getUint8"); - -verifyNotEnumerable(DataView.prototype.getUint8, "name"); -verifyNotWritable(DataView.prototype.getUint8, "name"); -verifyConfigurable(DataView.prototype.getUint8, "name"); +verifyProperty(DataView.prototype.getUint8, "name", { + value: "getUint8", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/getUint8/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/getUint8/not-a-constructor.js index 63c22bc84a..ff3afe1647 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/getUint8/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/getUint8/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.getUint8(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.getUint8(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/not-a-constructor.js index 3d57145553..ee47e8ebb7 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setBigInt64(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setBigInt64(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setBigUint64/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setBigUint64/not-a-constructor.js index 393dab357e..1e07e42d5e 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setBigUint64/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setBigUint64/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setBigUint64(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setBigUint64(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/browser.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-number-value.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-number-value.js new file mode 100644 index 0000000000..7978099dcd --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-number-value.js @@ -0,0 +1,27 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Detached buffer is checked after ToNumber(value) +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +var v = { + valueOf: function() { + throw new Test262Error(); + } +}; + +$DETACHBUFFER(buffer); +assert.throws(Test262Error, function() { + sample.setFloat16(0, v); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-toindex-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-toindex-byteoffset.js new file mode 100644 index 0000000000..864850f787 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-after-toindex-byteoffset.js @@ -0,0 +1,26 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Detached buffer is only checked after ToIndex(requestIndex) +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +$DETACHBUFFER(buffer); + +assert.throws(RangeError, function() { + sample.setFloat16(Infinity, 0); +}, "Infinity"); + +assert.throws(RangeError, function() { + sample.setFloat16(-1, 0); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-before-outofrange-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-before-outofrange-byteoffset.js new file mode 100644 index 0000000000..1d9d289e63 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer-before-outofrange-byteoffset.js @@ -0,0 +1,24 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Detached buffer is checked before out of range byteOffset's value +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var sample; +var buffer = new ArrayBuffer(12); + +sample = new DataView(buffer, 0); + +$DETACHBUFFER(buffer); + +assert.throws(TypeError, function() { + sample.setFloat16(13, 0); +}, "13"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer.js new file mode 100644 index 0000000000..11e71b7cb8 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/detached-buffer.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Throws a TypeError if buffer is detached +features: [Float16Array] +includes: [detachArrayBuffer.js] +---*/ + +var buffer = new ArrayBuffer(1); +var sample = new DataView(buffer, 0); + +$DETACHBUFFER(buffer); +assert.throws(TypeError, function() { + sample.setFloat16(0, 0); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-check-before-value-conversion.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-check-before-value-conversion.js new file mode 100644 index 0000000000..e1b2b18b35 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-check-before-value-conversion.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + RangeError exception for negative index is thrown before the value conversion. +features: [Float16Array] +---*/ + +var dataView = new DataView(new ArrayBuffer(8), 0); + +var poisoned = { + valueOf: function() { + throw new Test262Error("valueOf called"); + } +}; + +assert.throws(RangeError, function() { + dataView.setFloat16(-1.5, poisoned); +}, "setFloat16(-1.5, poisoned)"); + +assert.throws(RangeError, function() { + dataView.setFloat16(-1, poisoned); +}, "setFloat16(-1, poisoned)"); + +assert.throws(RangeError, function() { + dataView.setFloat16(-Infinity, poisoned); +}, "setFloat16(-Infinity, poisoned)"); + +assert.throws(RangeError, function() { + dataView.setFloat16(Infinity, poisoned); +}, "setFloat16(Infinity, poisoned)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-is-out-of-range.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-is-out-of-range.js new file mode 100644 index 0000000000..11f0e02a03 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/index-is-out-of-range.js @@ -0,0 +1,71 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Throws a RangeError if getIndex + elementSize > viewSize +features: [Float16Array] +---*/ + +var sample; +var buffer = new ArrayBuffer(12); + +sample = new DataView(buffer, 0); + +assert.throws(RangeError, function() { + sample.setFloat16(Infinity, 39); +}, "getIndex == Infinity"); + +assert.throws(RangeError, function() { + sample.setFloat16(13, 39); +}, "13 + 2 > 12"); + +assert.throws(RangeError, function() { + sample.setFloat16(12, 39); +}, "12 + 2 > 12"); + +assert.throws(RangeError, function() { + sample.setFloat16(11, 39); +}, "11 + 2 > 12"); + +sample = new DataView(buffer, 10); +assert.throws(RangeError, function() { + sample.setFloat16(1, 39); +}, "1 + 2 > 2 (offset)"); + +sample = new DataView(buffer, 11); +assert.throws(RangeError, function() { + sample.setFloat16(0, 39); +}, "0 + 2 > 1 (offset)"); + +sample = new DataView(buffer, 0, 2); +assert.throws(RangeError, function() { + sample.setFloat16(1, 39); +}, "1 + 2 > 2 (length)"); + +sample = new DataView(buffer, 0, 1); +assert.throws(RangeError, function() { + sample.setFloat16(0, 39); +}, "0 + 2 > 1 (length)"); + +sample = new DataView(buffer, 4, 2); +assert.throws(RangeError, function() { + sample.setFloat16(1, 39); +}, "1 + 2 > 2 (offset+length)"); + +sample = new DataView(buffer, 4, 1); +assert.throws(RangeError, function() { + sample.setFloat16(0, 39); +}, "0 + 2 > 1 (offset+length)"); + +sample = new DataView(buffer, 0); +assert.sameValue(sample.getFloat16(0), 0, "[0] no value was set"); +assert.sameValue(sample.getFloat16(2), 0, "[1] no value was set"); +assert.sameValue(sample.getFloat16(4), 0, "[2] no value was set"); +assert.sameValue(sample.getFloat16(6), 0, "[3] no value was set"); +assert.sameValue(sample.getFloat16(8), 0, "[4] no value was set"); +assert.sameValue(sample.getFloat16(10), 0, "[5] no value was set"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/length.js new file mode 100644 index 0000000000..d6e2809511 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/length.js @@ -0,0 +1,20 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + DataView.prototype.setFloat16.length is 2. +features: [Float16Array] +includes: [propertyHelper.js] +---*/ + +verifyProperty(DataView.prototype.setFloat16, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/name.js new file mode 100644 index 0000000000..41ef3bb195 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/name.js @@ -0,0 +1,20 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + DataView.prototype.setFloat16.name is "setFloat16". +features: [Float16Array] +includes: [propertyHelper.js] +---*/ + +verifyProperty(DataView.prototype.setFloat16, "name", { + value: "setFloat16", + writable: false, + enumerable: false, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/negative-byteoffset-throws.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/negative-byteoffset-throws.js new file mode 100644 index 0000000000..84722723ad --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/negative-byteoffset-throws.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Throws a RangeError if getIndex < 0 +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(12); +var sample = new DataView(buffer, 0); + +assert.throws(RangeError, function() { + sample.setFloat16(-1, 39); +}, "-1"); +assert.sameValue(sample.getFloat32(0), 0, "-1 - no value was set"); + +assert.throws(RangeError, function() { + sample.setFloat16(-Infinity, 39); +}, "-Infinity"); +assert.sameValue(sample.getFloat32(0), 0, "-Infinity - no value was set"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/no-value-arg.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/no-value-arg.js new file mode 100644 index 0000000000..75f634b0a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/no-value-arg.js @@ -0,0 +1,20 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Set value as undefined (cast to NaN) when value argument is not present +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(8); +var sample = new DataView(buffer, 0); + +var result = sample.setFloat16(0); + +assert.sameValue(sample.getFloat16(0), NaN); +assert.sameValue(result, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/not-a-constructor.js new file mode 100644 index 0000000000..549f33ba39 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/not-a-constructor.js @@ -0,0 +1,24 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + DataView.prototype.setFloat16 does not implement [[Construct]], is not new-able +includes: [isConstructor.js] +features: [Float16Array, Reflect.construct, DataView, arrow-function, ArrayBuffer] +---*/ + +assert.sameValue( + isConstructor(DataView.prototype.setFloat16), + false, + 'isConstructor(DataView.prototype.setFloat16) must return false' +); + +assert.throws(TypeError, () => { + let dv = new DataView(new ArrayBuffer(16)); new dv.setFloat16(0, 0); +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/range-check-after-value-conversion.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/range-check-after-value-conversion.js new file mode 100644 index 0000000000..04e87fc18c --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/range-check-after-value-conversion.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setFloat16 +description: > + Index bounds checks are performed after value conversion. +features: [Float16Array] +---*/ + +var dataView = new DataView(new ArrayBuffer(8), 0); + +var poisoned = { + valueOf: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + dataView.setFloat16(100, poisoned); +}, "setFloat16(100, poisoned)"); + +assert.throws(Test262Error, function() { + dataView.setFloat16('100', poisoned); +}, "setFloat16('100', poisoned)"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/resizable-buffer.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/resizable-buffer.js new file mode 100644 index 0000000000..17b09d9b13 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/resizable-buffer.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-arraybuffer-resizable) shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- Float16Array,resizable-arraybuffer is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-dataview.prototype.setfloat16 +description: Throws a TypeError if buffer is out-of-bounds +features: [Float16Array, DataView, ArrayBuffer, resizable-arraybuffer] +---*/ + +assert.sameValue( + typeof ArrayBuffer.prototype.resize, + 'function', + 'implements ArrayBuffer.prototype.resize' +); + +var buffer = new ArrayBuffer(24, {maxByteLength: 32}); +var sample = new DataView(buffer, 0, 16); + +try { + buffer.resize(32); +} catch (_) {} + +assert.sameValue(sample.setFloat16(0, 10), undefined, 'following grow'); + +try { + buffer.resize(16); +} catch (_) {} + +assert.sameValue(sample.setFloat16(0, 20), undefined, 'following shrink (within bounds)'); + +var expectedError; +try { + buffer.resize(8); + expectedError = TypeError; +} catch (_) { + expectedError = Test262Error; +} + +assert.throws(expectedError, function() { + sample.setFloat16(0, 30); + throw new Test262Error('the operation completed successfully'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js new file mode 100644 index 0000000000..d56fea3aa5 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset-symbol.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Return abrupt from ToNumber(symbol byteOffset) +features: [Float16Array, Symbol] +---*/ + +var buffer = new ArrayBuffer(1); +var sample = new DataView(buffer, 0); + +var s = Symbol("1"); + +assert.throws(TypeError, function() { + sample.setFloat16(s); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset.js new file mode 100644 index 0000000000..4c70428fc1 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-byteoffset.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Return abrupt from ToNumber(byteOffset) +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(1); +var sample = new DataView(buffer, 0); + +var bo1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var bo2 = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + sample.setFloat16(bo1, 1); +}, "valueOf"); + +assert.throws(Test262Error, function() { + sample.setFloat16(bo2, 1); +}, "toString"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value-symbol.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value-symbol.js new file mode 100644 index 0000000000..01639d1e10 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value-symbol.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Return abrupt from ToNumber(symbol value) +features: [Float16Array, Symbol] +---*/ + +var buffer = new ArrayBuffer(4); +var sample = new DataView(buffer, 0); + +var s = Symbol("1"); + +assert.throws(TypeError, function() { + sample.setFloat16(0, s); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value.js new file mode 100644 index 0000000000..802757cffc --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/return-abrupt-from-tonumber-value.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Return abrupt from ToNumber(value) +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(4); +var sample = new DataView(buffer, 0); + +var bo1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var bo2 = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + sample.setFloat16(0, bo1); +}, "valueOf"); + +assert.throws(Test262Error, function() { + sample.setFloat16(0, bo2); +}, "toString"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-little-endian-order.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-little-endian-order.js new file mode 100644 index 0000000000..dcbdd57594 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-little-endian-order.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Set values with little endian order. +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(2); +var sample = new DataView(buffer, 0); + +var result; + +result = sample.setFloat16(0, 42, true); // 01010001 01000000 +assert.sameValue(result, undefined, "returns undefined #1"); +assert.sameValue(sample.getFloat16(0), 2.158203125); // 01000000 01010001 + +result = sample.setFloat16(0, 2.158203125, true); +assert.sameValue(result, undefined, "returns undefined #2"); +assert.sameValue(sample.getFloat16(0), 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-return-undefined.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-return-undefined.js new file mode 100644 index 0000000000..52212f556a --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/set-values-return-undefined.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Set values and return undefined +features: [Float16Array] +includes: [byteConversionValues.js] +---*/ + +var buffer = new ArrayBuffer(2); +var sample = new DataView(buffer, 0); +var values = byteConversionValues.values; +var expectedValues = byteConversionValues.expected.Float16; + +values.forEach(function(value, i) { + var result; + var expected = expectedValues[i]; + + result = sample.setFloat16(0, value, false); + + assert.sameValue( + sample.getFloat16(0), + expected, + "value: " + value + ); + assert.sameValue( + result, + undefined, + "return is undefined, value: " + value + ); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/shell.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-has-no-dataview-internal.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-has-no-dataview-internal.js new file mode 100644 index 0000000000..e0d2c72daa --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-has-no-dataview-internal.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Throws a TypeError if this does not have a [[DataView]] internal slot +features: [Float16Array, Int8Array] +---*/ + +var setFloat16 = DataView.prototype.setFloat16; + +assert.throws(TypeError, function() { + setFloat16.call({}); +}, "{}"); + +assert.throws(TypeError, function() { + setFloat16.call([]); +}, "[]"); + +var ab = new ArrayBuffer(1); +assert.throws(TypeError, function() { + setFloat16.call(ab); +}, "ArrayBuffer"); + +var ta = new Int8Array(); +assert.throws(TypeError, function() { + setFloat16.call(ta); +}, "TypedArray"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-is-not-object.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-is-not-object.js new file mode 100644 index 0000000000..182647f76f --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/this-is-not-object.js @@ -0,0 +1,42 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: Throws a TypeError if this is not Object +features: [Float16Array, Symbol] +---*/ + +var setFloat16 = DataView.prototype.setFloat16; + +assert.throws(TypeError, function() { + setFloat16.call(undefined); +}, "undefined"); + +assert.throws(TypeError, function() { + setFloat16.call(null); +}, "null"); + +assert.throws(TypeError, function() { + setFloat16.call(1); +}, "1"); + +assert.throws(TypeError, function() { + setFloat16.call("string"); +}, "string"); + +assert.throws(TypeError, function() { + setFloat16.call(true); +}, "true"); + +assert.throws(TypeError, function() { + setFloat16.call(false); +}, "false"); + +var s = Symbol("1"); +assert.throws(TypeError, function() { + setFloat16.call(s); +}, "symbol"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/to-boolean-littleendian.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/to-boolean-littleendian.js new file mode 100644 index 0000000000..1840009be6 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/to-boolean-littleendian.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + Boolean littleEndian argument coerced in ToBoolean +features: [Float16Array, Symbol] +---*/ + +var buffer = new ArrayBuffer(2); +var sample = new DataView(buffer, 0); + +// False +sample.setFloat16(0, 1); +assert.sameValue(sample.getFloat16(0), 1, "no arg"); +sample.setFloat16(0, 2, undefined); +assert.sameValue(sample.getFloat16(0), 2, "undefined"); +sample.setFloat16(0, 3, null); +assert.sameValue(sample.getFloat16(0), 3, "null"); +sample.setFloat16(0, 4, 0); +assert.sameValue(sample.getFloat16(0), 4, "0"); +sample.setFloat16(0, 5, ""); +assert.sameValue(sample.getFloat16(0), 5, "the empty string"); + +// True +sample.setFloat16(0, 6, {}); // 01000110 00000000 +assert.sameValue(sample.getFloat16(0), 0.000004172325134277344, "{}"); // 00000000 01000110 +sample.setFloat16(0, 7, Symbol("1")); // 01000111 00000000 +assert.sameValue(sample.getFloat16(0), 0.000004231929779052734, "symbol"); // 00000000 01000111 +sample.setFloat16(0, 8, 1); // 01001000 00000000 +assert.sameValue(sample.getFloat16(0), 0.000004291534423828125, "1"); // 00000000 01001000 +sample.setFloat16(0, 9, "string"); // 01001000 10000000 +assert.sameValue(sample.getFloat16(0), -0.000004291534423828125, "string"); // 10000000 01001000 + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/toindex-byteoffset.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/toindex-byteoffset.js new file mode 100644 index 0000000000..2e637768de --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat16/toindex-byteoffset.js @@ -0,0 +1,99 @@ +// |reftest| shell-option(--enable-float16array) skip-if(!this.hasOwnProperty('Float16Array')||!xulRuntime.shell) -- Float16Array is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setfloat16 +description: > + ToIndex conversions on byteOffset +features: [Float16Array] +---*/ + +var buffer = new ArrayBuffer(6); +var sample = new DataView(buffer, 0); + +var obj1 = { + valueOf: function() { + return 3; + } +}; + +var obj2 = { + toString: function() { + return 4; + } +}; + +sample.setFloat16(0, 0); +sample.setFloat16(-0, 42); +assert.sameValue(sample.getFloat16(0), 42, "-0"); + +sample.setFloat16(3, 0); +sample.setFloat16(obj1, 42); +assert.sameValue(sample.getFloat16(3), 42, "object's valueOf"); + +sample.setFloat16(4, 0); +sample.setFloat16(obj2, 42); +assert.sameValue(sample.getFloat16(4), 42, "object's toString"); + +sample.setFloat16(0, 0); +sample.setFloat16("", 42); +assert.sameValue(sample.getFloat16(0), 42, "the Empty string"); + +sample.setFloat16(0, 0); +sample.setFloat16("0", 42); +assert.sameValue(sample.getFloat16(0), 42, "string '0'"); + +sample.setFloat16(2, 0); +sample.setFloat16("2", 42); +assert.sameValue(sample.getFloat16(2), 42, "string '2'"); + +sample.setFloat16(1, 0); +sample.setFloat16(true, 42); +assert.sameValue(sample.getFloat16(1), 42, "true"); + +sample.setFloat16(0, 0); +sample.setFloat16(false, 42); +assert.sameValue(sample.getFloat16(0), 42, "false"); + +sample.setFloat16(0, 0); +sample.setFloat16(NaN, 42); +assert.sameValue(sample.getFloat16(0), 42, "NaN"); + +sample.setFloat16(0, 0); +sample.setFloat16(null, 42); +assert.sameValue(sample.getFloat16(0), 42, "null"); + +sample.setFloat16(0, 0); +sample.setFloat16(0.1, 42); +assert.sameValue(sample.getFloat16(0), 42, "0.1"); + +sample.setFloat16(0, 0); +sample.setFloat16(0.9, 42); +assert.sameValue(sample.getFloat16(0), 42, "0.9"); + +sample.setFloat16(1, 0); +sample.setFloat16(1.1, 42); +assert.sameValue(sample.getFloat16(1), 42, "1.1"); + +sample.setFloat16(1, 0); +sample.setFloat16(1.9, 42); +assert.sameValue(sample.getFloat16(1), 42, "1.9"); + +sample.setFloat16(0, 0); +sample.setFloat16(-0.1, 42); +assert.sameValue(sample.getFloat16(0), 42, "-0.1"); + +sample.setFloat16(0, 0); +sample.setFloat16(-0.99999, 42); +assert.sameValue(sample.getFloat16(0), 42, "-0.99999"); + +sample.setFloat16(0, 0); +sample.setFloat16(undefined, 42); +assert.sameValue(sample.getFloat16(0), 42, "undefined"); + +sample.setFloat16(0, 7); +sample.setFloat16(); +assert.sameValue(sample.getFloat16(0), NaN, "no arg"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/length.js index aeda1f8804..80fdfa5ab8 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setFloat32.length, 2); - -verifyNotEnumerable(DataView.prototype.setFloat32, "length"); -verifyNotWritable(DataView.prototype.setFloat32, "length"); -verifyConfigurable(DataView.prototype.setFloat32, "length"); +verifyProperty(DataView.prototype.setFloat32, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/name.js index 497527f0ab..56e832d61c 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setFloat32.name, "setFloat32"); - -verifyNotEnumerable(DataView.prototype.setFloat32, "name"); -verifyNotWritable(DataView.prototype.setFloat32, "name"); -verifyConfigurable(DataView.prototype.setFloat32, "name"); +verifyProperty(DataView.prototype.setFloat32, "name", { + value: "setFloat32", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/not-a-constructor.js index 6388f109ab..c0d4b634cf 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat32/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setFloat32(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setFloat32(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/length.js index 50eb0bbe97..2fcf6428b3 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setFloat64.length, 2); - -verifyNotEnumerable(DataView.prototype.setFloat64, "length"); -verifyNotWritable(DataView.prototype.setFloat64, "length"); -verifyConfigurable(DataView.prototype.setFloat64, "length"); +verifyProperty(DataView.prototype.setFloat64, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/name.js index 05ca0ec912..e788228f90 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setFloat64.name, "setFloat64"); - -verifyNotEnumerable(DataView.prototype.setFloat64, "name"); -verifyNotWritable(DataView.prototype.setFloat64, "name"); -verifyConfigurable(DataView.prototype.setFloat64, "name"); +verifyProperty(DataView.prototype.setFloat64, "name", { + value: "setFloat64", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/not-a-constructor.js index 12ff2af998..305dd13372 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setFloat64/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setFloat64(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setFloat64(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt16/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt16/length.js index 74e11083b2..1e1640d623 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt16/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt16/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setInt16.length, 2); - -verifyNotEnumerable(DataView.prototype.setInt16, "length"); -verifyNotWritable(DataView.prototype.setInt16, "length"); -verifyConfigurable(DataView.prototype.setInt16, "length"); +verifyProperty(DataView.prototype.setInt16, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt16/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt16/name.js index 15220b4d94..3841b8e318 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt16/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt16/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setInt16.name, "setInt16"); - -verifyNotEnumerable(DataView.prototype.setInt16, "name"); -verifyNotWritable(DataView.prototype.setInt16, "name"); -verifyConfigurable(DataView.prototype.setInt16, "name"); +verifyProperty(DataView.prototype.setInt16, "name", { + value: "setInt16", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt16/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt16/not-a-constructor.js index b04ec4ac06..85616d68cd 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt16/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt16/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setInt16(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setInt16(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt32/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt32/length.js index 57bcc4db46..9d1fe1515a 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt32/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt32/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setInt32.length, 2); - -verifyNotEnumerable(DataView.prototype.setInt32, "length"); -verifyNotWritable(DataView.prototype.setInt32, "length"); -verifyConfigurable(DataView.prototype.setInt32, "length"); +verifyProperty(DataView.prototype.setInt32, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt32/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt32/name.js index 54f2572e30..22c81b434b 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt32/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt32/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setInt32.name, "setInt32"); - -verifyNotEnumerable(DataView.prototype.setInt32, "name"); -verifyNotWritable(DataView.prototype.setInt32, "name"); -verifyConfigurable(DataView.prototype.setInt32, "name"); +verifyProperty(DataView.prototype.setInt32, "name", { + value: "setInt32", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt32/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt32/not-a-constructor.js index 2f73e1a327..43cc02faf8 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt32/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt32/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setInt32(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setInt32(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt8/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt8/length.js index 8900d3121e..c1fb981599 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt8/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt8/length.js @@ -22,10 +22,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setInt8.length, 2); - -verifyNotEnumerable(DataView.prototype.setInt8, "length"); -verifyNotWritable(DataView.prototype.setInt8, "length"); -verifyConfigurable(DataView.prototype.setInt8, "length"); +verifyProperty(DataView.prototype.setInt8, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt8/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt8/name.js index 8464b328a4..4be8f0eb0a 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt8/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt8/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setInt8.name, "setInt8"); - -verifyNotEnumerable(DataView.prototype.setInt8, "name"); -verifyNotWritable(DataView.prototype.setInt8, "name"); -verifyConfigurable(DataView.prototype.setInt8, "name"); +verifyProperty(DataView.prototype.setInt8, "name", { + value: "setInt8", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setInt8/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setInt8/not-a-constructor.js index e497bc1d7b..63c758cfe1 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setInt8/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setInt8/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setInt8(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setInt8(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint16/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint16/length.js index 51e8fa626d..87c8e16952 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint16/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint16/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setUint16.length, 2); - -verifyNotEnumerable(DataView.prototype.setUint16, "length"); -verifyNotWritable(DataView.prototype.setUint16, "length"); -verifyConfigurable(DataView.prototype.setUint16, "length"); +verifyProperty(DataView.prototype.setUint16, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint16/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint16/name.js index 25d12bb4b4..58e6dc20d6 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint16/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint16/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setUint16.name, "setUint16"); - -verifyNotEnumerable(DataView.prototype.setUint16, "name"); -verifyNotWritable(DataView.prototype.setUint16, "name"); -verifyConfigurable(DataView.prototype.setUint16, "name"); +verifyProperty(DataView.prototype.setUint16, "name", { + value: "setUint16", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint16/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint16/not-a-constructor.js index d03027a4e5..e372ae6f8a 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint16/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint16/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setUint16(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setUint16(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint32/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint32/length.js index 274874d9b6..2a70739e78 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint32/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint32/length.js @@ -23,10 +23,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setUint32.length, 2); - -verifyNotEnumerable(DataView.prototype.setUint32, "length"); -verifyNotWritable(DataView.prototype.setUint32, "length"); -verifyConfigurable(DataView.prototype.setUint32, "length"); +verifyProperty(DataView.prototype.setUint32, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint32/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint32/name.js index 1d72ad1c79..c5b4ad6698 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint32/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint32/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setUint32.name, "setUint32"); - -verifyNotEnumerable(DataView.prototype.setUint32, "name"); -verifyNotWritable(DataView.prototype.setUint32, "name"); -verifyConfigurable(DataView.prototype.setUint32, "name"); +verifyProperty(DataView.prototype.setUint32, "name", { + value: "setUint32", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint32/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint32/not-a-constructor.js index 91a589a3c4..15e0115a3f 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint32/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint32/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setUint32(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setUint32(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint8/length.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint8/length.js index 63f58f4637..d003409e1f 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint8/length.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint8/length.js @@ -22,10 +22,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setUint8.length, 2); - -verifyNotEnumerable(DataView.prototype.setUint8, "length"); -verifyNotWritable(DataView.prototype.setUint8, "length"); -verifyConfigurable(DataView.prototype.setUint8, "length"); +verifyProperty(DataView.prototype.setUint8, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint8/name.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint8/name.js index f023fc8bdf..6521b0afd8 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint8/name.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint8/name.js @@ -19,10 +19,11 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(DataView.prototype.setUint8.name, "setUint8"); - -verifyNotEnumerable(DataView.prototype.setUint8, "name"); -verifyNotWritable(DataView.prototype.setUint8, "name"); -verifyConfigurable(DataView.prototype.setUint8, "name"); +verifyProperty(DataView.prototype.setUint8, "name", { + value: "setUint8", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setUint8/not-a-constructor.js b/js/src/tests/test262/built-ins/DataView/prototype/setUint8/not-a-constructor.js index 25899332b7..395755f64d 100644 --- a/js/src/tests/test262/built-ins/DataView/prototype/setUint8/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/DataView/prototype/setUint8/not-a-constructor.js @@ -29,7 +29,7 @@ assert.sameValue( assert.throws(TypeError, () => { let dv = new DataView(new ArrayBuffer(16)); new dv.setUint8(0, 0); -}, '`let dv = new DataView(new ArrayBuffer(16)); new dv.setUint8(0, 0)` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/DataView/shell.js b/js/src/tests/test262/built-ins/DataView/shell.js index 6bf8be5e31..2b6d995ad7 100644 --- a/js/src/tests/test262/built-ins/DataView/shell.js +++ b/js/src/tests/test262/built-ins/DataView/shell.js @@ -53,7 +53,22 @@ var byteConversionValues = { -4294967296, // - ( 2 ** 32 ) Infinity, -Infinity, - 0 + 0, + 2049, // an integer which rounds down under ties-to-even when cast to float16 + 2051, // an integer which rounds up under ties-to-even when cast to float16 + 0.00006103515625, // smallest normal float16 + 0.00006097555160522461, // largest subnormal float16 + 5.960464477539063e-8, // smallest float16 + 2.9802322387695312e-8, // largest double which rounds to 0 when cast to float16 + 2.980232238769532e-8, // smallest double which does not round to 0 when cast to float16 + 8.940696716308594e-8, // a double which rounds up to a subnormal under ties-to-even when cast to float16 + 1.4901161193847656e-7, // a double which rounds down to a subnormal under ties-to-even when cast to float16 + 1.490116119384766e-7, // the next double above the one on the previous line one + 65504, // max finite float16 + 65520, // smallest double which rounds to infinity when cast to float16 + 65519.99999999999, // largest double which does not round to infinity when cast to float16 + 0.000061005353927612305, // smallest double which rounds to a non-subnormal when cast to float16 + 0.0000610053539276123 // largest double which rounds to a subnormal when cast to float16 ], expected: { @@ -98,7 +113,22 @@ var byteConversionValues = { 0, // -4294967296 0, // Infinity 0, // -Infinity - 0 + 0, // 0 + 1, // 2049 + 3, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + -32, // 65504 + -16, // 65520 + -17, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Uint8: [ 127, // 127 @@ -141,7 +171,22 @@ var byteConversionValues = { 0, // -4294967296 0, // Infinity 0, // -Infinity - 0 + 0, // 0 + 1, // 2049 + 3, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + 224, // 65504 + 240, // 65520 + 239, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Uint8Clamped: [ 127, // 127 @@ -184,7 +229,22 @@ var byteConversionValues = { 0, // -4294967296 255, // Infinity 0, // -Infinity - 0 + 0, // 0 + 255, // 2049 + 255, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + 255, // 65504 + 255, // 65520 + 255, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Int16: [ 127, // 127 @@ -227,7 +287,22 @@ var byteConversionValues = { 0, // -4294967296 0, // Infinity 0, // -Infinity - 0 + 0, // 0 + 2049, // 2049 + 2051, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + -32, // 65504 + -16, // 65520 + -17, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Uint16: [ 127, // 127 @@ -270,7 +345,22 @@ var byteConversionValues = { 0, // -4294967296 0, // Infinity 0, // -Infinity - 0 + 0, // 0 + 2049, // 2049 + 2051, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + 65504, // 65504 + 65520, // 65520 + 65519, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Int32: [ 127, // 127 @@ -313,7 +403,22 @@ var byteConversionValues = { 0, // -4294967296 0, // Infinity 0, // -Infinity - 0 + 0, // 0 + 2049, // 2049 + 2051, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + 65504, // 65504 + 65520, // 65520 + 65519, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Uint32: [ 127, // 127 @@ -356,93 +461,138 @@ var byteConversionValues = { 0, // -4294967296 0, // Infinity 0, // -Infinity - 0 + 0, // 0 + 2049, // 2049 + 2051, // 2051 + 0, // 0.00006103515625 + 0, // 0.00006097555160522461 + 0, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 0, // 2.980232238769532e-8 + 0, // 8.940696716308594e-8 + 0, // 1.4901161193847656e-7 + 0, // 1.490116119384766e-7 + 65504, // 65504 + 65520, // 65520 + 65519, // 65519.99999999999 + 0, // 0.000061005353927612305 + 0 // 0.0000610053539276123 ], Float16: [ - 127, // 127 - 128, // 128 - 32768, // 32767 - 32768, // 32768 - Infinity, // 2147483647 - Infinity, // 2147483648 - 255, // 255 - 256, // 256 - Infinity, // 65535 - Infinity, // 65536 - Infinity, // 4294967295 - Infinity, // 4294967296 - Infinity, // 9007199254740991 - Infinity, // 9007199254740992 - 1.099609375, // 1.1 - 0.0999755859375, // 0.1 - 0.5, // 0.5 - 0.5, // 0.50000001, - 0.60009765625, // 0.6 - 0.7001953125, // 0.7 - NaN, // undefined - -1, // -1 - -0, // -0 - -0.0999755859375, // -0.1 - -1.099609375, // -1.1 - NaN, // NaN - -127, // -127 - -128, // -128 - -32768, // -32767 - -32768, // -32768 - -Infinity, // -2147483647 - -Infinity, // -2147483648 - -255, // -255 - -256, // -256 - -Infinity, // -65535 - -Infinity, // -65536 - -Infinity, // -4294967295 - -Infinity, // -4294967296 - Infinity, // Infinity - -Infinity, // -Infinity - 0 + 127, // 127 + 128, // 128 + 32768, // 32767 + 32768, // 32768 + Infinity, // 2147483647 + Infinity, // 2147483648 + 255, // 255 + 256, // 256 + Infinity, // 65535 + Infinity, // 65536 + Infinity, // 4294967295 + Infinity, // 4294967296 + Infinity, // 9007199254740991 + Infinity, // 9007199254740992 + 1.099609375, // 1.1 + 0.0999755859375, // 0.1 + 0.5, // 0.5 + 0.5, // 0.50000001, + 0.60009765625, // 0.6 + 0.7001953125, // 0.7 + NaN, // undefined + -1, // -1 + -0, // -0 + -0.0999755859375, // -0.1 + -1.099609375, // -1.1 + NaN, // NaN + -127, // -127 + -128, // -128 + -32768, // -32767 + -32768, // -32768 + -Infinity, // -2147483647 + -Infinity, // -2147483648 + -255, // -255 + -256, // -256 + -Infinity, // -65535 + -Infinity, // -65536 + -Infinity, // -4294967295 + -Infinity, // -4294967296 + Infinity, // Infinity + -Infinity, // -Infinity + 0, // 0 + 2048, // 2049 + 2052, // 2051 + 0.00006103515625, // 0.00006103515625 + 0.00006097555160522461, // 0.00006097555160522461 + 5.960464477539063e-8, // 5.960464477539063e-8 + 0, // 2.9802322387695312e-8 + 5.960464477539063e-8, // 2.980232238769532e-8 + 1.1920928955078125e-7, // 8.940696716308594e-8 + 1.1920928955078125e-7, // 1.4901161193847656e-7 + 1.7881393432617188e-7, // 1.490116119384766e-7 + 65504, // 65504 + Infinity, // 65520 + 65504, // 65519.99999999999 + 0.00006103515625, // 0.000061005353927612305 + 0.00006097555160522461 // 0.0000610053539276123 ], Float32: [ - 127, // 127 - 128, // 128 - 32767, // 32767 - 32768, // 32768 - 2147483648, // 2147483647 - 2147483648, // 2147483648 - 255, // 255 - 256, // 256 - 65535, // 65535 - 65536, // 65536 - 4294967296, // 4294967295 - 4294967296, // 4294967296 - 9007199254740992, // 9007199254740991 - 9007199254740992, // 9007199254740992 - 1.100000023841858, // 1.1 - 0.10000000149011612, // 0.1 - 0.5, // 0.5 - 0.5, // 0.50000001, - 0.6000000238418579, // 0.6 - 0.699999988079071, // 0.7 - NaN, // undefined - -1, // -1 - -0, // -0 - -0.10000000149011612, // -0.1 - -1.100000023841858, // -1.1 - NaN, // NaN - -127, // -127 - -128, // -128 - -32767, // -32767 - -32768, // -32768 - -2147483648, // -2147483647 - -2147483648, // -2147483648 - -255, // -255 - -256, // -256 - -65535, // -65535 - -65536, // -65536 - -4294967296, // -4294967295 - -4294967296, // -4294967296 - Infinity, // Infinity - -Infinity, // -Infinity - 0 + 127, // 127 + 128, // 128 + 32767, // 32767 + 32768, // 32768 + 2147483648, // 2147483647 + 2147483648, // 2147483648 + 255, // 255 + 256, // 256 + 65535, // 65535 + 65536, // 65536 + 4294967296, // 4294967295 + 4294967296, // 4294967296 + 9007199254740992, // 9007199254740991 + 9007199254740992, // 9007199254740992 + 1.100000023841858, // 1.1 + 0.10000000149011612, // 0.1 + 0.5, // 0.5 + 0.5, // 0.50000001, + 0.6000000238418579, // 0.6 + 0.699999988079071, // 0.7 + NaN, // undefined + -1, // -1 + -0, // -0 + -0.10000000149011612, // -0.1 + -1.100000023841858, // -1.1 + NaN, // NaN + -127, // -127 + -128, // -128 + -32767, // -32767 + -32768, // -32768 + -2147483648, // -2147483647 + -2147483648, // -2147483648 + -255, // -255 + -256, // -256 + -65535, // -65535 + -65536, // -65536 + -4294967296, // -4294967295 + -4294967296, // -4294967296 + Infinity, // Infinity + -Infinity, // -Infinity + 0, // 0 + 2049, // 2049 + 2051, // 2051 + 0.00006103515625, // 0.00006103515625 + 0.00006097555160522461, // 0.00006097555160522461 + 5.960464477539063e-8, // 5.960464477539063e-8 + 2.9802322387695312e-8, // 2.9802322387695312e-8 + 2.9802322387695312e-8, // 2.980232238769532e-8 + 8.940696716308594e-8, // 8.940696716308594e-8 + 1.4901161193847656e-7, // 1.4901161193847656e-7 + 1.4901161193847656e-7, // 1.490116119384766e-7 + 65504, // 65504 + 65520, // 65520 + 65520, // 65519.99999999999 + 0.000061005353927612305, // 0.000061005353927612305 + 0.000061005353927612305 // 0.0000610053539276123 ], Float64: [ 127, // 127 @@ -485,7 +635,22 @@ var byteConversionValues = { -4294967296, // -4294967296 Infinity, // Infinity -Infinity, // -Infinity - 0 + 0, // 0 + 2049, // 2049 + 2051, // 2051 + 0.00006103515625, // 0.00006103515625 + 0.00006097555160522461, // 0.00006097555160522461 + 5.960464477539063e-8, // 5.960464477539063e-8 + 2.9802322387695312e-8, // 2.9802322387695312e-8 + 2.980232238769532e-8, // 2.980232238769532e-8 + 8.940696716308594e-8, // 8.940696716308594e-8 + 1.4901161193847656e-7, // 1.4901161193847656e-7 + 1.490116119384766e-7, // 1.490116119384766e-7 + 65504, // 65504 + 65520, // 65520 + 65519.99999999999, // 65519.99999999999 + 0.000061005353927612305, // 0.000061005353927612305 + 0.0000610053539276123 // 0.0000610053539276123 ] } }; -- cgit v1.2.3