diff options
Diffstat (limited to 'test/built-ins/TypedArray')
19 files changed, 115 insertions, 618 deletions
diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js deleted file mode 100644 index 5db1cfcae..000000000 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.fill -description: Consistent canonicalization of NaN values -info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) - - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. - - ... - - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) - - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , - isLittleEndian ] ) - - ... - 8. If type is "Float32", then - a. Set rawBytes to a List containing the 4 bytes that are the result - of converting value to IEEE 754-2008 binary32 format using “Round to - nearest, ties to even” rounding mode. If isLittleEndian is false, the - bytes are arranged in big endian order. Otherwise, the bytes are - arranged in little endian order. If value is NaN, rawValue may be set - to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number - encoding. An implementation must always choose the same encoding for - each implementation distinguishable NaN value. - 9. Else, if type is "Float64", then - a. Set rawBytes to a List containing the 8 bytes that are the IEEE - 754-2008 binary64 format encoding of value. If isLittleEndian is false, - the bytes are arranged in big endian order. Otherwise, the bytes are - arranged in little endian order. If value is NaN, rawValue may be set - to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number - encoding. An implementation must always choose the same encoding for - each implementation distinguishable NaN value. - ... -includes: [nans.js, testBigIntTypedArray.js, compareArray.js] -features: [BigInt, TypedArray] ----*/ - -function body(FloatArray) { - var sample = new FloatArray(3); - var control, idx, someNaN, sampleBytes, controlBytes; - - for (idx = 0; idx < distinctNaNs.length; ++idx) { - someNaN = distinctNaNs[idx]; - control = new FloatArray([someNaN, someNaN, someNaN]); - - sample.fill(someNaN); - - sampleBytes = new Uint8Array(sample.buffer); - controlBytes = new Uint8Array(control.buffer); - assert(compareArray(sampleBytes, controlBytes), 'NaN value #' + idx); - } -} - -testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js deleted file mode 100644 index 676d18f86..000000000 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.fill -description: > - Fills all the elements with non numeric values values. -info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) - - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. - - ... - - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) - - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , - isLittleEndian ] ) - - ... - 8. If type is "Float32", then - ... - 9. Else, if type is "Float64", then - ... - 10. Else, - ... - b. Let convOp be the abstract operation named in the Conversion Operation - column in Table 50 for Element Type type. - c. Let intValue be convOp(value). - d. If intValue ≥ 0, then - ... - e. Else, - ... -includes: [byteConversionValues.js, testBigIntTypedArray.js] -features: [BigInt, TypedArray] ----*/ - -testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { - var sample = new TA([initial]); - - sample.fill(value); - - assert.sameValue(sample[0], expected, value + " converts to " + expected); -}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index 8ad970667..fe301ac8f 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -38,8 +38,8 @@ features: [BigInt, Symbol.species, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n]); - var otherTA = TA === Int8Array ? Int16Array : Int8Array; - var other = new otherTA([1, 0, 1]); + var otherTA = TA === BigInt64Array ? BigUint64Array : BigInt64Array; + var other = new otherTA([1n, 0n, 1n]); var result; sample.constructor = {}; @@ -50,5 +50,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { result = sample.filter(function() {}); assert.sameValue(result, other, "returned another typedarray"); - assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); + assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js deleted file mode 100644 index 1b9534f1a..000000000 --- a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.map -description: Consistent canonicalization of NaN values -info: | - 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) - - ... - 8. Repeat, while k < len - ... - d. Perform ? Set(A, Pk, mappedValue, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... - - 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , - isLittleEndian ] ) - - ... - 8. If type is "Float32", then - a. Set rawBytes to a List containing the 4 bytes that are the result - of converting value to IEEE 754-2008 binary32 format using “Round to - nearest, ties to even” rounding mode. If isLittleEndian is false, the - bytes are arranged in big endian order. Otherwise, the bytes are - arranged in little endian order. If value is NaN, rawValue may be set - to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number - encoding. An implementation must always choose the same encoding for - each implementation distinguishable NaN value. - 9. Else, if type is "Float64", then - a. Set rawBytes to a List containing the 8 bytes that are the IEEE - 754-2008 binary64 format encoding of value. If isLittleEndian is false, - the bytes are arranged in big endian order. Otherwise, the bytes are - arranged in little endian order. If value is NaN, rawValue may be set - to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number - encoding. An implementation must always choose the same encoding for - each implementation distinguishable NaN value. - ... -includes: [nans.js, testBigIntTypedArray.js, compareArray.js] -features: [BigInt, TypedArray] ----*/ - -function body(FloatArray) { - var sample = new FloatArray(distinctNaNs); - var sampleBytes, resultBytes; - var i = 0; - - var result = sample.map(function() { - return distinctNaNs[i++]; - }); - - sampleBytes = new Uint8Array(sample.buffer); - resultBytes = new Uint8Array(result.buffer); - - assert(compareArray(sampleBytes, resultBytes)); -} - -testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js deleted file mode 100644 index 6f2b83a63..000000000 --- a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.map -description: > - Verify conversion values on returned instance -info: | - 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) - - ... - 8. Repeat, while k < len - ... - d. Perform ? Set(A, Pk, mappedValue, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... - - 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , - isLittleEndian ] ) - - ... - 8. If type is "Float32", then - ... - 9. Else, if type is "Float64", then - ... - 10. Else, - ... - b. Let convOp be the abstract operation named in the Conversion Operation - column in Table 50 for Element Type type. - c. Let intValue be convOp(value). - d. If intValue ≥ 0, then - ... - e. Else, - ... -includes: [byteConversionValues.js, testBigIntTypedArray.js] -features: [BigInt, TypedArray] ----*/ - -testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { - var sample = new TA([initial]); - - var result = sample.map(function() { - return value; - }); - - assert.sameValue(result[0], expected, value + " converts to " + expected); -}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js deleted file mode 100644 index 78fd9dcbb..000000000 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.set-array-offset -description: > - Values conversions on ToNumber(src property value) -info: | - 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) - - 1. Assert: array is any ECMAScript language value other than an Object with a - [[TypedArrayName]] internal slot. If it is such an Object, the definition in - 22.2.3.23.2 applies. - ... - 21. Repeat, while targetByteIndex < limit - a. Let Pk be ! ToString(k). - b. Let kNumber be ? ToNumber(? Get(src, Pk)). - c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. - d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, - kNumber). - ... -includes: [byteConversionValues.js, testBigIntTypedArray.js] -features: [BigInt, TypedArray] ----*/ - -testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { - var sample = new TA([initial]); - - sample.set([value]); - - assert.sameValue(sample[0], expected, "["+value+"] => ["+expected +"]"); -}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js deleted file mode 100644 index 979b0b384..000000000 --- a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.set.2 -description: Preservation of bit-level encoding -info: | - [...] - 28. Else, - a. NOTE: If srcType and targetType are the same, the transfer must be - performed in a manner that preserves the bit-level encoding of the - source data. - b. Repeat, while targetByteIndex < limit - i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8"). - ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8", - value). - iii. Set srcByteIndex to srcByteIndex + 1. - iv. Set targetByteIndex to targetByteIndex + 1. -includes: [nans.js, compareArray.js, testBigIntTypedArray.js] -features: [BigInt, TypedArray] ----*/ - -function body(FloatArray) { - var source = new FloatArray(distinctNaNs); - var target = new FloatArray(distinctNaNs.length); - var sourceBytes, targetBytes; - - target.set(source); - - sourceBytes = new Uint8Array(source.buffer); - targetBytes = new Uint8Array(target.buffer); - - assert(compareArray(sourceBytes, targetBytes)) -} - -testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js deleted file mode 100644 index 7cf6f1111..000000000 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.set-typedarray-offset -description: > - Set converted values from different buffer of different types and different type instances -includes: [byteConversionValues.js, testBigIntTypedArray.js] -features: [BigInt, SharedArrayBuffer] ----*/ - -testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { - if (TA === Float64Array || TA === Float32Array || TA === Uint8ClampedArray) { - return; - } - if (TA === Int32Array) { - return; - } - - var sab, src, target; - - sab = new SharedArrayBuffer(4); - src = new Int32Array(sab); - src[0] = value; - target = new TA([initial]); - - target.set(src); - - assert.sameValue(target[0], expected, "src is SAB-backed"); - - sab = new SharedArrayBuffer(4); - src = new Int32Array([value]); - target = new TA(sab); - target[0] = initial; - - target.set(src); - - assert.sameValue(target[0], expected, "target is SAB-backed"); - - var sab1 = new SharedArrayBuffer(4); - var sab2 = new SharedArrayBuffer(4); - src = new Int32Array(sab1); - src[0] = value; - target = new TA(sab2); - target[0] = initial; - - target.set(src); - - assert.sameValue(target[0], expected, "src and target are SAB-backed"); -}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js deleted file mode 100644 index fbb323f97..000000000 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.set-typedarray-offset -description: > - Set converted values from different buffer and different type instances -info: | - 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) - - 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, - the definition in 22.2.3.23.1 applies. - ... - 23. If SameValue(srcBuffer, targetBuffer) is true, then - ... - 24. Else, let srcByteIndex be srcByteOffset. - ... - 27. If SameValue(srcType, targetType) is true, then, - ... - 28. Else, - a. Repeat, while targetByteIndex < limit - i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, srcType). - ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, - value). -includes: [byteConversionValues.js, testBigIntTypedArray.js] -features: [BigInt, TypedArray] ----*/ - -testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { - if (TA === Float64Array) { - return; - } - var src = new Float64Array([value]); - var target = new TA([initial]); - - target.set(src); - - assert.sameValue(target[0], expected); -}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js index 408633ced..344aceeda 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js @@ -11,97 +11,93 @@ includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, SharedArrayBuffer, TypedArray] ---*/ -var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; - testWithBigIntTypedArrayConstructors(function(TA) { - var other = Int32Array; - var sab = new SharedArrayBuffer(2 * other.BYTES_PER_ELEMENT); - var src = new other(sab); - src[0] = 42; - src[1] = 43; + var sab = new SharedArrayBuffer(2 * BigInt64Array.BYTES_PER_ELEMENT); + var src = new BigInt64Array(sab); + src[0] = 42n; + src[1] = 43n; var sample, result; - sample = new TA([1, 2, 3, 4]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src is SAB-backed, offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src is SAB-backed, offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src is SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - - src = new other([42, 43]); + src = new BigInt64Array([42n, 43n]); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "sample is SAB-backed, offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "sample is SAB-backed, offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "sample is SAB-backed, offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "sample is SAB-backed, offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "sample is SAB-backed, offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "sample is SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - var sab1 = new SharedArrayBuffer(2 * other.BYTES_PER_ELEMENT); - src = new other(sab1); - src[0] = 42; - src[1] = 43; + var sab1 = new SharedArrayBuffer(2 * BigInt64Array.BYTES_PER_ELEMENT); + src = new BigInt64Array(sab1); + src[0] = 42n; + src[1] = 43n; var sab2; sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "src and sample are SAB-backed, offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src and sample are SAB-backed, offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "src and sample are SAB-backed, offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src and sample are SAB-backed, offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}, int_views); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js index 6e1279ea4..f179ba052 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js @@ -10,98 +10,95 @@ includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, SharedArrayBuffer, TypedArray] ---*/ -var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; - testWithBigIntTypedArrayConstructors(function(TA) { var sample, result; var sab = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT); var src = new TA(sab); - src[0] = 42; - src[1] = 43; + src[0] = 42n; + src[1] = 43n; - sample = new TA([1, 2, 3, 4]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src is SAB-backed, offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src is SAB-backed, offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src is SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - - src = new TA([42, 43]); + src = new TA([42n, 43n]); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "sample is SAB-backed, offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "sample is SAB-backed, offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "sample is SAB-backed, offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "sample is SAB-backed, offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "sample is SAB-backed, offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "sample is SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); var sab1 = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT); src = new TA(sab1); - src[0] = 42; - src[1] = 43; + src[0] = 42n; + src[1] = 43n; var sab2; sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "src and sample are SAB-backed, offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src and sample are SAB-backed, offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "src and sample are SAB-backed, offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src and sample are SAB-backed, offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}, int_views); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js index 86c686e3b..7e60fba13 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js @@ -11,41 +11,39 @@ includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, SharedArrayBuffer, TypedArray] ---*/ -var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; - testWithBigIntTypedArrayConstructors(function(TA) { var sample, src, result, sab; sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert(compareArray(sample, [1, 2, 3, 4]), "offset: 0, result: " + sample); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert(compareArray(sample, [1, 1, 2, 4]), "offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 1n, 2n, 4n]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); - sample[0] = 1; - sample[1] = 2; - sample[2] = 3; - sample[3] = 4; + sample[0] = 1n; + sample[1] = 2n; + sample[2] = 3n; + sample[3] = 4n; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 1, 2]), "offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 1n, 2n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}, int_views); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js deleted file mode 100644 index e27565331..000000000 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.slice -description: Preservation of bit-level encoding -info: | - [...] - 15. Else if count > 0, then - [...] - e. NOTE: If srcType and targetType are the same, the transfer must be - performed in a manner that preserves the bit-level encoding of the - source data. - f. Let srcByteOffet be the value of O's [[ByteOffset]] internal slot. - g. Let targetByteIndex be A's [[ByteOffset]] internal slot. - h. Let srcByteIndex be (k × elementSize) + srcByteOffet. - i. Let limit be targetByteIndex + count × elementSize. - j. Repeat, while targetByteIndex < limit - i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8"). - ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8", - value). - iii. Increase srcByteIndex by 1. - iv. Increase targetByteIndex by 1. -includes: [nans.js, compareArray.js, testBigIntTypedArray.js] -features: [BigInt, TypedArray] ----*/ - -function body(FloatArray) { - var subject = new FloatArray(distinctNaNs); - var sliced, subjectBytes, slicedBytes; - - sliced = subject.slice(); - - subjectBytes = new Uint8Array(subject.buffer); - slicedBytes = new Uint8Array(sliced.buffer); - - assert(compareArray(subjectBytes, slicedBytes)); -} - -testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js index 5dee0faf7..c81ad9ab8 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js @@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.constructor = {}; sample.constructor[Symbol.species] = function(count) { - var other = TA === Int8Array ? Int16Array : Int8Array; + var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; $DETACHBUFFER(sample.buffer); return new other(count); }; diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js index adcd18b71..851468f93 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js @@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var sample, result, other; var ctor = {}; ctor[Symbol.species] = function(count) { - other = TA === Int8Array ? Int16Array : Int8Array; + other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; $DETACHBUFFER(sample.buffer); return new other(count); }; diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index 81be8cd76..bfd0fff4f 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -38,7 +38,7 @@ features: [BigInt, Symbol.species, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n]); - var other = new Int8Array([1, 0, 1]); + var other = new BigInt64Array([1n, 0n, 1n]); var result; sample.constructor = {}; @@ -49,5 +49,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { result = sample.slice(0, 0); assert.sameValue(result, other, "returned another typedarray"); - assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); + assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); }); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js deleted file mode 100644 index 7a553b13e..000000000 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-%typedarray%.prototype.sort -description: Sort values to numeric ascending order -info: | - 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) - - When the TypedArray SortCompare abstract operation is called with two - arguments x and y, the following steps are taken: - - ... - - NOTE: Because NaN always compares greater than any other value, NaN property - values always sort to the end of the result when comparefn is not provided. -includes: [testBigIntTypedArray.js, compareArray.js] -features: [BigInt, TypedArray] ----*/ - -testWithBigIntTypedArrayConstructors(function(TA) { - var sample; - - sample = new TA([2, NaN, NaN, 0, 1]).sort(); - assert.sameValue(sample[0], 0, "#1 [0]"); - assert.sameValue(sample[1], 1, "#1 [1]"); - assert.sameValue(sample[2], 2, "#1 [2]"); - assert.sameValue(sample[3], NaN, "#1 [3]"); - assert.sameValue(sample[4], NaN, "#1 [4]"); - - sample = new TA([3, NaN, NaN, Infinity, 0, -Infinity, 2]).sort(); - assert.sameValue(sample[0], -Infinity, "#2 [0]"); - assert.sameValue(sample[1], 0, "#2 [1]"); - assert.sameValue(sample[2], 2, "#2 [2]"); - assert.sameValue(sample[3], 3, "#2 [3]"); - assert.sameValue(sample[4], Infinity, "#2 [4]"); - assert.sameValue(sample[5], NaN, "#2 [5]"); - assert.sameValue(sample[6], NaN, "#2 [6]"); -}, [Float64Array, Float32Array]); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js index 57b491551..79b7e5469 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -25,29 +25,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort(); assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers"); - - sample = new TA([1n, 0n, -0n, 2n]).sort(); - assert(compareArray(sample, [0n, 0n, 1n, 2n]), "0s"); }); -testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA([-4, 3, 4, -3, 2, -2, 1, 0]).sort(); - assert(compareArray(sample, [-4, -3, -2, 0, 1, 2, 3, 4]), "negative values"); -}, [Float64Array, Float32Array, Int8Array, Int16Array, Int32Array]); - -testWithBigIntTypedArrayConstructors(function(TA) { - var sample; - - sample = new TA([0.5, 0, 1.5, 1]).sort(); - assert(compareArray(sample, [0, 0.5, 1, 1.5]), "non integers"); - - sample = new TA([0.5, 0, 1.5, -0.5, -1, -1.5, 1]).sort(); - assert(compareArray(sample, [-1.5, -1, -0.5, 0, 0.5, 1, 1.5]), "non integers + negatives"); - - sample = new TA([1, 0, -0, 2]).sort(); - assert(compareArray(sample, [0, 0, 1, 2]), "0 and -0"); - - sample = new TA([3, 4, Infinity, -Infinity, 1, 2]).sort(); - assert(compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity]), "infinities"); - -}, [Float64Array, Float32Array]); +var sample = new BigInt64Array([-4n, 3n, 4n, -3n, 2n, -2n, 1n, 0n]).sort(); +assert(compareArray(sample, [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n]), "negative values"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index ee537263a..0aa28e822 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n]); - var other = new Int8Array([1, 0, 1]); + var other = new BigInt64Array([1n, 0n, 1n]); var result; sample.constructor = {}; @@ -48,5 +48,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { result = sample.subarray(0, 0); assert.sameValue(result, other, "returned another typedarray"); - assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); + assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); }); |