mirror of
https://github.com/tc39/test262.git
synced 2025-07-29 00:44:32 +02:00
Minimize use of convertToBigInt
This commit is contained in:
parent
296657cd90
commit
3325e2a516
@ -29,48 +29,48 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, null),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'null value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, NaN),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'NaN value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, false),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'false value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, true),
|
||||
convertToBigInt([0, 0, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true),
|
||||
[0n, 0n, 2n, 3n]
|
||||
),
|
||||
'true value coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, '-2'),
|
||||
convertToBigInt([0, 0, 1, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, '-2'),
|
||||
[0n, 0n, 1n, 3n]
|
||||
),
|
||||
'string "-2" value coerced to integer -2'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, -2.5),
|
||||
convertToBigInt([0, 0, 1, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, -2.5),
|
||||
[0n, 0n, 1n, 3n]
|
||||
),
|
||||
'float -2.5 value coerced to integer -2'
|
||||
);
|
||||
|
@ -28,64 +28,64 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, undefined),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'undefined value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, false),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, false),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'false value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, NaN),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'NaN value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, null),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, null),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'null value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, true),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, true),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'true value coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, '1'),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, '1'),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'string "1" value coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0.5),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0.5),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'0.5 float value coerced to integer 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1.5),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1.5),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'1.5 float value coerced to integer 1'
|
||||
);
|
||||
|
@ -28,64 +28,64 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(undefined, 1),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'undefined value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(false, 1),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'false value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(NaN, 1),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'NaN value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(null, 1),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'null value coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(true, 0),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'true value coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin('1', 0),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin('1', 0),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'string "1" value coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0.5, 1),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0.5, 1),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'0.5 float value coerced to integer 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1.5, 0),
|
||||
convertToBigInt([0, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1.5, 0),
|
||||
[0n, 0n, 1n, 2n]
|
||||
),
|
||||
'1.5 float value coerced to integer 1'
|
||||
);
|
||||
|
@ -31,64 +31,64 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, -1),
|
||||
convertToBigInt([1, 2, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -1),
|
||||
[1n, 2n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, 0, -1),
|
||||
convertToBigInt([0, 1, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, 0, -1),
|
||||
[0n, 1n, 0n, 1n, 2n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(1, 2, -2),
|
||||
convertToBigInt([0, 2, 2, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, 2, -2),
|
||||
[0n, 2n, 2n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -2, -1),
|
||||
convertToBigInt([2, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -1),
|
||||
[2n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -2, -1),
|
||||
convertToBigInt([0, 1, 3, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2, -1),
|
||||
[0n, 1n, 3n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-3, -2, -1),
|
||||
convertToBigInt([0, 2, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -1),
|
||||
[0n, 2n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, -3, -1),
|
||||
convertToBigInt([0, 1, 2, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3, -1),
|
||||
[0n, 1n, 2n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-5, -2, -1),
|
||||
convertToBigInt([3, 1, 2, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2, -1),
|
||||
[3n, 1n, 2n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]'
|
||||
);
|
||||
|
@ -31,80 +31,80 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, -10),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -10),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, 1, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -2, -10),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -10),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -2, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -2, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -9, -10),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, -9, -10),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -9, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -9, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-3, -2, -10),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -10),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-3, -2, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-3, -2, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-7, -8, -9),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-7, -8, -9),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-7, -8, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-7, -8, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
@ -29,64 +29,64 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -10),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, -10),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -10),
|
||||
convertToBigInt([0, 1, 0, 1, 2])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -10),
|
||||
[0n, 1n, 0n, 1n, 2n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(2, -Infinity),
|
||||
convertToBigInt([1, 2, 1, 2, 3])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(2, -Infinity),
|
||||
[1n, 2n, 1n, 2n, 3n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(10, -10),
|
||||
convertToBigInt([0, 1, 2, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(10, -10),
|
||||
[0n, 1n, 2n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(10, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(10, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-9, -10),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-9, -10),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-9, -Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-9, -Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
@ -29,32 +29,32 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-10, 0),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-Infinity, 0),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-10, 2),
|
||||
convertToBigInt([2, 3, 4, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2),
|
||||
[2n, 3n, 4n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-Infinity, 2),
|
||||
convertToBigInt([3, 4, 5, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2),
|
||||
[3n, 4n, 5n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]'
|
||||
);
|
||||
|
@ -29,48 +29,48 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -1),
|
||||
convertToBigInt([3, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, -1),
|
||||
[3n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -2),
|
||||
convertToBigInt([0, 1, 3, 4, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2),
|
||||
[0n, 1n, 3n, 4n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(1, -2),
|
||||
convertToBigInt([0, 3, 4, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, -2),
|
||||
[0n, 3n, 4n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, -2),
|
||||
convertToBigInt([0, 1, 2, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-1, -2),
|
||||
[0n, 1n, 2n, 2n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, -3),
|
||||
convertToBigInt([0, 1, 2, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3),
|
||||
[0n, 1n, 2n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-5, -2),
|
||||
convertToBigInt([3, 4, 2, 3, 4])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2),
|
||||
[3n, 4n, 2n, 3n, 4n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]'
|
||||
);
|
||||
|
@ -29,24 +29,24 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, 0),
|
||||
convertToBigInt([0, 1, 2, 0])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 0),
|
||||
[0n, 1n, 2n, 0n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, 2),
|
||||
convertToBigInt([0, 1, 2, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, 2),
|
||||
[0n, 1n, 2n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, 2),
|
||||
convertToBigInt([0, 1, 2, 2])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 2),
|
||||
[0n, 1n, 2n, 2n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]'
|
||||
);
|
||||
|
@ -22,32 +22,32 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, 6),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 6),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, 1, Infinity),
|
||||
convertToBigInt([2, 3, 4, 5, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, Infinity),
|
||||
[2n, 3n, 4n, 5n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 6),
|
||||
convertToBigInt([0, 3, 4, 5, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 6),
|
||||
[0n, 3n, 4n, 5n, 4n, 5n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(1, 3, Infinity),
|
||||
convertToBigInt([1, 4, 5, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, Infinity),
|
||||
[1n, 4n, 5n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]'
|
||||
);
|
||||
|
@ -22,52 +22,52 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(6, 0),
|
||||
convertToBigInt([0, 1, 2, 3, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0),
|
||||
[0n, 1n, 2n, 3n, 4n, 5n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(Infinity, 0),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, 0),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(0, 6),
|
||||
convertToBigInt([0, 1, 2, 3, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6),
|
||||
[0n, 1n, 2n, 3n, 4n, 5n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(6, 6),
|
||||
convertToBigInt([0, 1, 2, 3, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6),
|
||||
[0n, 1n, 2n, 3n, 4n, 5n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(10, 10),
|
||||
convertToBigInt([0, 1, 2, 3, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10),
|
||||
[0n, 1n, 2n, 3n, 4n, 5n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(Infinity, Infinity),
|
||||
convertToBigInt([1, 2, 3, 4, 5])
|
||||
new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, Infinity),
|
||||
[1n, 2n, 3n, 4n, 5n]
|
||||
),
|
||||
'[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]'
|
||||
);
|
||||
|
@ -22,29 +22,29 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(0, 0),
|
||||
convertToBigInt([1, 2, 3, 4, 5, 6])
|
||||
new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0),
|
||||
[1n, 2n, 3n, 4n, 5n, 6n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(0, 2),
|
||||
convertToBigInt([3, 4, 5, 6, 5, 6])
|
||||
new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2),
|
||||
[3n, 4n, 5n, 6n, 5n, 6n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(3, 0),
|
||||
convertToBigInt([1, 2, 3, 1, 2, 3])
|
||||
new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0),
|
||||
[1n, 2n, 3n, 1n, 2n, 3n]
|
||||
)
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 4),
|
||||
convertToBigInt([0, 4, 5, 3, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 4),
|
||||
[0n, 4n, 5n, 3n, 4n, 5n]
|
||||
)
|
||||
);
|
||||
});
|
||||
|
@ -22,24 +22,24 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 0, 0),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 0),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 0, 2),
|
||||
convertToBigInt([0, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 2),
|
||||
[0n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, 2),
|
||||
convertToBigInt([1, 1, 2, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 2),
|
||||
[1n, 1n, 2n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]'
|
||||
);
|
||||
@ -57,16 +57,16 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
*/
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, 2),
|
||||
convertToBigInt([0, 0, 1, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, 2),
|
||||
[0n, 0n, 1n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 5),
|
||||
convertToBigInt([0, 3, 4, 3, 4, 5])
|
||||
new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 5),
|
||||
[0n, 3n, 4n, 3n, 4n, 5n]
|
||||
),
|
||||
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]'
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
assert.sameValue(result1, sample1);
|
||||
|
||||
var sample2 = new TA(convertToBigInt([1, 2, 3]));
|
||||
var sample2 = new TA([1n, 2n, 3n]);
|
||||
var result2 = sample2.copyWithin(1, 0);
|
||||
|
||||
assert.sameValue(result2, sample2);
|
||||
|
@ -29,16 +29,16 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, undefined),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, undefined),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(
|
||||
new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1),
|
||||
convertToBigInt([1, 2, 3, 3])
|
||||
new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1),
|
||||
[1n, 2n, 3n, 3n]
|
||||
),
|
||||
'[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]'
|
||||
);
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, Symbol.iterator, TypedArray]
|
||||
var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([0, 42, 64]));
|
||||
var sample = new TA([0n, 42n, 64n]);
|
||||
var iter = sample.entries();
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);
|
||||
|
@ -19,15 +19,15 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var itor = typedArray.entries();
|
||||
|
||||
var next = itor.next();
|
||||
assert(compareArray(next.value, [0, convertToBigInt(0)]));
|
||||
assert(compareArray(next.value, [0, 0n]));
|
||||
assert.sameValue(next.done, false);
|
||||
|
||||
next = itor.next();
|
||||
assert(compareArray(next.value, [1, convertToBigInt(42)]));
|
||||
assert(compareArray(next.value, [1, 42n]));
|
||||
assert.sameValue(next.done, false);
|
||||
|
||||
next = itor.next();
|
||||
assert(compareArray(next.value, [2, convertToBigInt(64)]));
|
||||
assert(compareArray(next.value, [2, 64n]));
|
||||
assert.sameValue(next.done, false);
|
||||
|
||||
next = itor.next();
|
||||
|
@ -26,7 +26,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
var thisArg = ["test262", 0, "ecma262", 0];
|
||||
@ -40,17 +40,17 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(thisArg.length, 4, "thisArg.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -38,17 +38,17 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results.length, 3, "results.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7, 8]));
|
||||
var sample = new TA([7n, 8n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -36,6 +36,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - key");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - key");
|
||||
|
||||
assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - value");
|
||||
assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - value");
|
||||
assert.sameValue(results[0][0], 7n, "results[0][0] - value");
|
||||
assert.sameValue(results[1][0], 8n, "results[1][0] - value");
|
||||
});
|
||||
|
@ -26,13 +26,13 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42]));
|
||||
var sample = new TA([40n, 41n, 42n]);
|
||||
|
||||
sample.every(function() {
|
||||
return 43;
|
||||
});
|
||||
|
||||
assert.sameValue(sample[0], convertToBigInt(40), "[0] == 40");
|
||||
assert.sameValue(sample[1], convertToBigInt(41), "[1] == 41");
|
||||
assert.sameValue(sample[2], convertToBigInt(42), "[2] == 42");
|
||||
assert.sameValue(sample[0], 40n, "[0] == 40");
|
||||
assert.sameValue(sample[1], 41n, "[1] == 41");
|
||||
assert.sameValue(sample[2], 42n, "[2] == 42");
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ features: [BigInt, Reflect.set, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
var newVal = 0;
|
||||
|
||||
sample.every(function(val, i) {
|
||||
@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
"get the changed value during the loop"
|
||||
);
|
||||
assert.sameValue(
|
||||
Reflect.set(sample, 0, convertToBigInt(7)),
|
||||
Reflect.set(sample, 0, 7n),
|
||||
true,
|
||||
"re-set a value for sample[0]"
|
||||
);
|
||||
@ -52,7 +52,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
return true;
|
||||
});
|
||||
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7");
|
||||
assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1");
|
||||
assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2");
|
||||
assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
|
||||
assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
|
||||
assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ var desc = {
|
||||
Object.defineProperty(TypedArray.prototype, "length", desc);
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43]));
|
||||
var sample = new TA([42n, 43n]);
|
||||
var calls = 0;
|
||||
|
||||
Object.defineProperty(TA.prototype, "length", desc);
|
||||
|
@ -27,15 +27,15 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
sample.every(function(v, i) {
|
||||
if (i < sample.length - 1) {
|
||||
sample[i+1] = convertToBigInt(42);
|
||||
sample[i+1] = 42n;
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
v, convertToBigInt(42), "method does not cache values before callbackfn calls"
|
||||
v, 42n, "method does not cache values before callbackfn calls"
|
||||
);
|
||||
return true;
|
||||
});
|
||||
|
@ -33,72 +33,72 @@ features: [BigInt, TypedArray]
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), undefined), convertToBigInt([1, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, undefined), [1n, 1n]),
|
||||
'`undefined` start coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, undefined), convertToBigInt([1, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, undefined), [1n, 1n]),
|
||||
'If end is undefined, let relativeEnd be len'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), null), convertToBigInt([1, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, null), [1n, 1n]),
|
||||
'`null` start coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, null), convertToBigInt([0, 0])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, null), [0n, 0n]),
|
||||
'`null` end coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), true), convertToBigInt([0, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, true), [0n, 1n]),
|
||||
'`true` start coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, true), convertToBigInt([1, 0])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, true), [1n, 0n]),
|
||||
'`true` end coerced to 1'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), false), convertToBigInt([1, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, false), [1n, 1n]),
|
||||
'`false` start coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, false), convertToBigInt([0, 0])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, false), [0n, 0n]),
|
||||
'`false` end coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), NaN), convertToBigInt([1, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, NaN), [1n, 1n]),
|
||||
'`NaN` start coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, NaN), convertToBigInt([0, 0])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, NaN), [0n, 0n]),
|
||||
'`NaN` end coerced to 0'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), '1'), convertToBigInt([0, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, '1'), [0n, 1n]),
|
||||
'string start coerced'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, '1'), convertToBigInt([1, 0])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, '1'), [1n, 0n]),
|
||||
'string end coerced'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 1.5), convertToBigInt([0, 1])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 1.5), [0n, 1n]),
|
||||
'start as a float number coerced'
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, 1.5), convertToBigInt([1, 0])),
|
||||
compareArray(new TA([0n, 0n]).fill(1n, 0, 1.5), [1n, 0n]),
|
||||
'end as a float number coerced'
|
||||
);
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
sample.fill({ valueOf() { return convertToBigInt(n++); } });
|
||||
|
||||
assert.sameValue(n, 2, "additional unexpected ToNumber() calls");
|
||||
assert.sameValue(sample[0], convertToBigInt(1), "incorrect ToNumber result in index 0");
|
||||
assert.sameValue(sample[1], convertToBigInt(1), "incorrect ToNumber result in index 1");
|
||||
assert.sameValue(sample[0], 1n, "incorrect ToNumber result in index 0");
|
||||
assert.sameValue(sample[1], 1n, "incorrect ToNumber result in index 1");
|
||||
});
|
||||
|
||||
|
@ -34,9 +34,9 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 1, 2), convertToBigInt([0, 8, 0])));
|
||||
assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -3, 4), convertToBigInt([0, 0, 8, 8, 0])));
|
||||
assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -2, -1), convertToBigInt([0, 0, 0, 8, 0])));
|
||||
assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -1, -3), convertToBigInt([0, 0, 0, 0, 0])));
|
||||
assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), 1, 3), convertToBigInt([0, 8, 8, 0, 0])));
|
||||
assert(compareArray(new TA([0n, 0n, 0n]).fill(8n, 1, 2), [0n, 8n, 0n]));
|
||||
assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -3, 4), [0n, 0n, 8n, 8n, 0n]));
|
||||
assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -2, -1), [0n, 0n, 0n, 8n, 0n]));
|
||||
assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -1, -3), [0n, 0n, 0n, 0n, 0n]));
|
||||
assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, 1, 3), [0n, 8n, 8n, 0n, 0n]));
|
||||
});
|
||||
|
@ -39,34 +39,34 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42]));
|
||||
sample = new TA([42n]);
|
||||
sample.fill(false);
|
||||
assert.sameValue(sample[0], convertToBigInt(0), "false => 0");
|
||||
assert.sameValue(sample[0], 0n, "false => 0");
|
||||
|
||||
sample = new TA(convertToBigInt([42]));
|
||||
sample = new TA([42n]);
|
||||
sample.fill(true);
|
||||
assert.sameValue(sample[0], convertToBigInt(1), "true => 1");
|
||||
assert.sameValue(sample[0], 1n, "true => 1");
|
||||
|
||||
sample = new TA(convertToBigInt([42]));
|
||||
sample = new TA([42n]);
|
||||
sample.fill("7");
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "string conversion");
|
||||
assert.sameValue(sample[0], 7n, "string conversion");
|
||||
|
||||
sample = new TA(convertToBigInt([42]));
|
||||
sample = new TA([42n]);
|
||||
sample.fill({
|
||||
toString: function() {
|
||||
return "1";
|
||||
},
|
||||
valueOf: function() {
|
||||
return convertToBigInt(7);
|
||||
return 7n;
|
||||
}
|
||||
});
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "object valueOf conversion before toString");
|
||||
assert.sameValue(sample[0], 7n, "object valueOf conversion before toString");
|
||||
|
||||
sample = new TA(convertToBigInt([42]));
|
||||
sample = new TA([42n]);
|
||||
sample.fill({
|
||||
toString: function() {
|
||||
return "7";
|
||||
}
|
||||
});
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "object toString when valueOf is absent");
|
||||
assert.sameValue(sample[0], 7n, "object toString when valueOf is absent");
|
||||
});
|
||||
|
@ -32,22 +32,22 @@ features: [BigInt, TypedArray]
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, 1), convertToBigInt([8, 0, 0])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 1), [8n, 0n, 0n]),
|
||||
"Fill elements from custom end position"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, -1), convertToBigInt([8, 8, 0])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, -1), [8n, 8n, 0n]),
|
||||
"negative end sets final position to max((length + relativeEnd), 0)"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, 5), convertToBigInt([8, 8, 8])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 5), [8n, 8n, 8n]),
|
||||
"end position is never higher than of length"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, -4), convertToBigInt([0, 0, 0])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, -4), [0n, 0n, 0n]),
|
||||
"end position is 0 when (len + relativeEnd) < 0"
|
||||
);
|
||||
});
|
||||
|
@ -30,22 +30,22 @@ features: [BigInt, TypedArray]
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 1), convertToBigInt([0, 8, 8])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, 1), [0n, 8n, 8n]),
|
||||
"Fill elements from custom start position"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 4), convertToBigInt([0, 0, 0])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, 4), [0n, 0n, 0n]),
|
||||
"start position is never higher than length"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), -1), convertToBigInt([0, 0, 8])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, -1), [0n, 0n, 8n]),
|
||||
"start < 0 sets initial position to max((len + relativeStart), 0)"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), -5), convertToBigInt([8, 8, 8])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n, -5), [8n, 8n, 8n]),
|
||||
"start position is 0 when (len + relativeStart) < 0"
|
||||
);
|
||||
});
|
||||
|
@ -31,14 +31,14 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert(
|
||||
compareArray(
|
||||
new TA().fill(convertToBigInt(8)),
|
||||
new TA().fill(8n),
|
||||
[]
|
||||
),
|
||||
"does not fill an empty instance"
|
||||
);
|
||||
|
||||
assert(
|
||||
compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8)), convertToBigInt([8, 8, 8])),
|
||||
compareArray(new TA([0n, 0n, 0n]).fill(8n), [8n, 8n, 8n]),
|
||||
"Default start and end indexes are 0 and this.length"
|
||||
);
|
||||
});
|
||||
|
@ -47,5 +47,5 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
}
|
||||
});
|
||||
|
||||
assert.sameValue(sample.fill(convertToBigInt(1), 0), sample);
|
||||
assert.sameValue(sample.fill(1n, 0), sample);
|
||||
});
|
||||
|
@ -37,6 +37,6 @@ var end = {
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA();
|
||||
assert.throws(Test262Error, function() {
|
||||
sample.fill(convertToBigInt(1), 0, end);
|
||||
sample.fill(1n, 0, end);
|
||||
});
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42]));
|
||||
var sample = new TA([42n]);
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
throw new Test262Error();
|
||||
|
@ -36,6 +36,6 @@ var start = {
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA();
|
||||
assert.throws(Test262Error, function() {
|
||||
sample.fill(convertToBigInt(1), start);
|
||||
sample.fill(1n, start);
|
||||
});
|
||||
});
|
||||
|
@ -10,11 +10,11 @@ features: [BigInt, TypedArray]
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample1 = new TA();
|
||||
var result1 = sample1.fill(convertToBigInt(1));
|
||||
var result1 = sample1.fill(1n);
|
||||
|
||||
assert.sameValue(result1, sample1);
|
||||
|
||||
var sample2 = new TA(42);
|
||||
var result2 = sample2.fill(convertToBigInt(7));
|
||||
var result2 = sample2.fill(7n);
|
||||
assert.sameValue(result2, sample2);
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
var thisArg = ["test262", 0, "ecma262", 0];
|
||||
@ -30,17 +30,17 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(thisArg.length, 4, "thisArg.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -28,17 +28,17 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results.length, 3, "results.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7, 8]));
|
||||
var sample = new TA([7n, 8n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -33,6 +33,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
|
||||
assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue");
|
||||
assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue");
|
||||
assert.sameValue(results[0][0], 7n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[1][0], 8n, "results[1][0] - kValue");
|
||||
});
|
||||
|
@ -11,13 +11,13 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample1 = new TA(3);
|
||||
|
||||
sample1[1] = convertToBigInt(1);
|
||||
sample1[1] = 1n;
|
||||
|
||||
sample1.filter(function() {
|
||||
return 42;
|
||||
});
|
||||
|
||||
assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0");
|
||||
assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1");
|
||||
assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0");
|
||||
assert.sameValue(sample1[0], 0n, "[0] == 0");
|
||||
assert.sameValue(sample1[1], 1n, "[1] == 1");
|
||||
assert.sameValue(sample1[2], 0n, "[2] == 0");
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, Reflect.set, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
var newVal = 0;
|
||||
|
||||
sample.filter(function(val, i) {
|
||||
@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
"get the changed value during the loop"
|
||||
);
|
||||
assert.sameValue(
|
||||
Reflect.set(sample, 0, convertToBigInt(7)),
|
||||
Reflect.set(sample, 0, 7n),
|
||||
true,
|
||||
"re-set a value for sample[0]"
|
||||
);
|
||||
@ -41,7 +41,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
newVal++;
|
||||
});
|
||||
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "changed values after interaction [0] == 7");
|
||||
assert.sameValue(sample[1], convertToBigInt(1), "changed values after interaction [1] == 1");
|
||||
assert.sameValue(sample[2], convertToBigInt(2), "changed values after interaction [2] == 2");
|
||||
assert.sameValue(sample[0], 7n, "changed values after interaction [0] == 7");
|
||||
assert.sameValue(sample[1], 1n, "changed values after interaction [1] == 1");
|
||||
assert.sameValue(sample[2], 2n, "changed values after interaction [2] == 2");
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42]));
|
||||
var sample = new TA([40n, 41n, 42n]);
|
||||
var result;
|
||||
|
||||
result = sample.filter(function() { return true; });
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42]));
|
||||
var sample = new TA([40n, 41n, 42n]);
|
||||
|
||||
[
|
||||
true,
|
||||
|
@ -27,7 +27,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42, 43]));
|
||||
var sample = new TA([40n, 41n, 42n, 43n]);
|
||||
|
||||
Object.defineProperty(sample, "constructor", {
|
||||
get: function() {
|
||||
|
@ -27,7 +27,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42, 43]));
|
||||
var sample = new TA([40n, 41n, 42n, 43n]);
|
||||
var calls = 0;
|
||||
var result;
|
||||
|
||||
|
@ -31,7 +31,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
var callbackfn = function() { return true; };
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42, 43]));
|
||||
var sample = new TA([40n, 41n, 42n, 43n]);
|
||||
|
||||
sample.constructor = 42;
|
||||
assert.throws(TypeError, function() {
|
||||
|
@ -27,7 +27,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42, 43]));
|
||||
var sample = new TA([40n, 41n, 42n, 43n]);
|
||||
var calls = 0;
|
||||
var result;
|
||||
|
||||
|
@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 42, 42]));
|
||||
var sample = new TA([40n, 42n, 42n]);
|
||||
var result, ctorThis;
|
||||
|
||||
sample.constructor = {};
|
||||
@ -47,7 +47,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
return new TA(count);
|
||||
};
|
||||
|
||||
sample.filter(function(v) { return v === convertToBigInt(42); });
|
||||
sample.filter(function(v) { return v === 42n; });
|
||||
|
||||
assert.sameValue(result.length, 1, "called with 1 argument");
|
||||
assert.sameValue(result[0], 2, "[0] is the new captured length");
|
||||
|
@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40]));
|
||||
var sample = new TA([40n]);
|
||||
var otherTA = TA === Int8Array ? Int16Array : Int8Array;
|
||||
var other = new otherTA([1, 0, 1]);
|
||||
var result;
|
||||
|
@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([40, 41, 42]));
|
||||
var sample = new TA([40n, 41n, 42n]);
|
||||
var calls = 0;
|
||||
var other, result;
|
||||
|
||||
@ -52,5 +52,5 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
assert.sameValue(calls, 1, "ctor called once");
|
||||
assert.sameValue(result, other, "return is instance of custom constructor");
|
||||
assert(compareArray(result, convertToBigInt([40, 41, 42])), "values are set on the new obj");
|
||||
assert(compareArray(result, [40n, 41n, 42n]), "values are set on the new obj");
|
||||
});
|
||||
|
@ -17,15 +17,15 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
sample.filter(function(v, i) {
|
||||
if (i < sample.length - 1) {
|
||||
sample[i+1] = convertToBigInt(42);
|
||||
sample[i+1] = 42n;
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
v, convertToBigInt(42), "method does not cache values before callbackfn calls"
|
||||
v, 42n, "method does not cache values before callbackfn calls"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -17,14 +17,14 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([41, 1, 42, 7]));
|
||||
var sample = new TA([41n, 1n, 42n, 7n]);
|
||||
var result;
|
||||
|
||||
result = sample.filter(function() { return true; });
|
||||
assert(compareArray(result, convertToBigInt([41, 1, 42, 7])), "values are set #1");
|
||||
assert(compareArray(result, [41n, 1n, 42n, 7n]), "values are set #1");
|
||||
|
||||
result = sample.filter(function(v) {
|
||||
return v > convertToBigInt(40);
|
||||
return v > 40n;
|
||||
});
|
||||
assert(compareArray(result, convertToBigInt([41, 42])), "values are set #2");
|
||||
assert(compareArray(result, [41n, 42n]), "values are set #2");
|
||||
});
|
||||
|
@ -38,7 +38,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
}
|
||||
});
|
||||
|
||||
var sample = new TA(convertToBigInt([42]));
|
||||
var sample = new TA([42n]);
|
||||
|
||||
Object.defineProperty(sample, "length", {
|
||||
get: function() {
|
||||
@ -49,6 +49,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
assert.sameValue(
|
||||
sample.find(function() { return true; }),
|
||||
convertToBigInt(42)
|
||||
42n
|
||||
);
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var arr = convertToBigInt([1, 2, 3]);
|
||||
var arr = [1n, 2n, 3n];
|
||||
var sample;
|
||||
var result;
|
||||
|
||||
@ -38,41 +38,41 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
sample.find(function(val, i) {
|
||||
sample[i] = arr[i];
|
||||
|
||||
assert.sameValue(val, convertToBigInt(0), "value is not mapped to instance");
|
||||
assert.sameValue(val, 0n, "value is not mapped to instance");
|
||||
});
|
||||
assert(compareArray(sample, arr), "values set during each predicate call");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.find(function(val, i) {
|
||||
if ( i === 0 ) {
|
||||
sample[2] = convertToBigInt(7);
|
||||
sample[2] = 7n;
|
||||
}
|
||||
return val === convertToBigInt(7);
|
||||
return val === 7n;
|
||||
});
|
||||
assert.sameValue(result, convertToBigInt(7), "value found");
|
||||
assert.sameValue(result, 7n, "value found");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.find(function(val, i) {
|
||||
if ( i === 0 ) {
|
||||
sample[2] = convertToBigInt(7);
|
||||
sample[2] = 7n;
|
||||
}
|
||||
return val === convertToBigInt(3);
|
||||
return val === 3n;
|
||||
});
|
||||
assert.sameValue(result, undefined, "value not found");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.find(function(val, i) {
|
||||
if ( i > 0 ) {
|
||||
sample[0] = convertToBigInt(7);
|
||||
sample[0] = 7n;
|
||||
}
|
||||
return val === convertToBigInt(7);
|
||||
return val === 7n;
|
||||
});
|
||||
assert.sameValue(result, undefined, "value not found - changed after call");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.find(function() {
|
||||
sample[0] = convertToBigInt(7);
|
||||
sample[0] = 7n;
|
||||
return true;
|
||||
});
|
||||
assert.sameValue(result, convertToBigInt(1), "find() returns previous found value");
|
||||
assert.sameValue(result, 1n, "find() returns previous found value");
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([39, 2, 62]));
|
||||
var sample = new TA([39n, 2n, 62n]);
|
||||
var results = [];
|
||||
var result;
|
||||
|
||||
@ -43,19 +43,19 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results.length, 3, "predicate is called for each index");
|
||||
|
||||
result = results[0];
|
||||
assert.sameValue(result[0], convertToBigInt(39), "results[0][0] === 39, value");
|
||||
assert.sameValue(result[0], 39n, "results[0][0] === 39, value");
|
||||
assert.sameValue(result[1], 0, "results[0][1] === 0, index");
|
||||
assert.sameValue(result[2], sample, "results[0][2] === sample, instance");
|
||||
assert.sameValue(result.length, 3, "results[0].length === 3 arguments");
|
||||
|
||||
result = results[1];
|
||||
assert.sameValue(result[0], convertToBigInt(2), "results[1][0] === 2, value");
|
||||
assert.sameValue(result[0], 2n, "results[1][0] === 2, value");
|
||||
assert.sameValue(result[1], 1, "results[1][1] === 1, index");
|
||||
assert.sameValue(result[2], sample, "results[1][2] === sample, instance");
|
||||
assert.sameValue(result.length, 3, "results[1].length === 3 arguments");
|
||||
|
||||
result = results[2];
|
||||
assert.sameValue(result[0], convertToBigInt(62), "results[2][0] === 62, value");
|
||||
assert.sameValue(result[0], 62n, "results[2][0] === 62, value");
|
||||
assert.sameValue(result[1], 2, "results[2][1] === 2, index");
|
||||
assert.sameValue(result[2], sample, "results[2][2] === sample, instance");
|
||||
assert.sameValue(result.length, 3, "results[2].length === 3 arguments");
|
||||
|
@ -29,7 +29,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([39, 2, 62]));
|
||||
var sample = new TA([39n, 2n, 62n]);
|
||||
var called, result;
|
||||
|
||||
called = 0;
|
||||
@ -37,29 +37,29 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
called++;
|
||||
return true;
|
||||
});
|
||||
assert.sameValue(result, convertToBigInt(39), "returned true on sample[0]");
|
||||
assert.sameValue(result, 39n, "returned true on sample[0]");
|
||||
assert.sameValue(called, 1, "predicate was called once");
|
||||
|
||||
called = 0;
|
||||
result = sample.find(function(val) {
|
||||
called++;
|
||||
return val === convertToBigInt(62);
|
||||
return val === 62n;
|
||||
});
|
||||
assert.sameValue(called, 3, "predicate was called three times");
|
||||
assert.sameValue(result, convertToBigInt(62), "returned true on sample[3]");
|
||||
assert.sameValue(result, 62n, "returned true on sample[3]");
|
||||
|
||||
result = sample.find(function() { return "string"; });
|
||||
assert.sameValue(result, convertToBigInt(39), "ToBoolean(string)");
|
||||
assert.sameValue(result, 39n, "ToBoolean(string)");
|
||||
|
||||
result = sample.find(function() { return {}; });
|
||||
assert.sameValue(result, convertToBigInt(39), "ToBoolean(object)");
|
||||
assert.sameValue(result, 39n, "ToBoolean(object)");
|
||||
|
||||
result = sample.find(function() { return Symbol(""); });
|
||||
assert.sameValue(result, convertToBigInt(39), "ToBoolean(symbol)");
|
||||
assert.sameValue(result, 39n, "ToBoolean(symbol)");
|
||||
|
||||
result = sample.find(function() { return 1; });
|
||||
assert.sameValue(result, convertToBigInt(39), "ToBoolean(number)");
|
||||
assert.sameValue(result, 39n, "ToBoolean(number)");
|
||||
|
||||
result = sample.find(function() { return -1; });
|
||||
assert.sameValue(result, convertToBigInt(39), "ToBoolean(negative number)");
|
||||
assert.sameValue(result, 39n, "ToBoolean(negative number)");
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
}
|
||||
});
|
||||
|
||||
var sample = new TA(convertToBigInt([42]));
|
||||
var sample = new TA([42n]);
|
||||
|
||||
Object.defineProperty(sample, "length", {
|
||||
get: function() {
|
||||
|
@ -26,7 +26,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var arr = convertToBigInt([10, 20, 30]);
|
||||
var arr = [10n, 20n, 30n];
|
||||
var sample;
|
||||
var result;
|
||||
|
||||
@ -34,34 +34,34 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
sample.findIndex(function(val, i) {
|
||||
sample[i] = arr[i];
|
||||
|
||||
assert.sameValue(val, convertToBigInt(0), "value is not mapped to instance");
|
||||
assert.sameValue(val, 0n, "value is not mapped to instance");
|
||||
});
|
||||
assert(compareArray(sample, arr), "values set during each predicate call");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.findIndex(function(val, i) {
|
||||
if ( i === 0 ) {
|
||||
sample[2] = convertToBigInt(7);
|
||||
sample[2] = 7n;
|
||||
}
|
||||
return val === convertToBigInt(7);
|
||||
return val === 7n;
|
||||
});
|
||||
assert.sameValue(result, 2, "value found");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.findIndex(function(val, i) {
|
||||
if ( i === 0 ) {
|
||||
sample[2] = convertToBigInt(7);
|
||||
sample[2] = 7n;
|
||||
}
|
||||
return val === convertToBigInt(30);
|
||||
return val === 30n;
|
||||
});
|
||||
assert.sameValue(result, -1, "value not found");
|
||||
|
||||
sample = new TA(arr);
|
||||
result = sample.findIndex(function(val, i) {
|
||||
if ( i > 0 ) {
|
||||
sample[0] = convertToBigInt(7);
|
||||
sample[0] = 7n;
|
||||
}
|
||||
return val === convertToBigInt(7);
|
||||
return val === 7n;
|
||||
});
|
||||
assert.sameValue(result, -1, "value not found - changed after call");
|
||||
});
|
||||
|
@ -28,7 +28,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([39, 2, 62]));
|
||||
var sample = new TA([39n, 2n, 62n]);
|
||||
var results = [];
|
||||
var result;
|
||||
|
||||
@ -41,19 +41,19 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results.length, 3, "predicate is called for each index");
|
||||
|
||||
result = results[0];
|
||||
assert.sameValue(result[0], convertToBigInt(39), "results[0][0] === 39, value");
|
||||
assert.sameValue(result[0], 39n, "results[0][0] === 39, value");
|
||||
assert.sameValue(result[1], 0, "results[0][1] === 0, index");
|
||||
assert.sameValue(result[2], sample, "results[0][2] === sample, instance");
|
||||
assert.sameValue(result.length, 3, "results[0].length === 3, arguments");
|
||||
|
||||
result = results[1];
|
||||
assert.sameValue(result[0], convertToBigInt(2), "results[1][0] === 2, value");
|
||||
assert.sameValue(result[0], 2n, "results[1][0] === 2, value");
|
||||
assert.sameValue(result[1], 1, "results[1][1] === 1, index");
|
||||
assert.sameValue(result[2], sample, "results[1][2] === sample, instance");
|
||||
assert.sameValue(result.length, 3, "results[1].length === 3, arguments");
|
||||
|
||||
result = results[2];
|
||||
assert.sameValue(result[0], convertToBigInt(62), "results[2][0] === 62, value");
|
||||
assert.sameValue(result[0], 62n, "results[2][0] === 62, value");
|
||||
assert.sameValue(result[1], 2, "results[2][1] === 2, index");
|
||||
assert.sameValue(result[2], sample, "results[2][2] === sample, instance");
|
||||
assert.sameValue(result.length, 3, "results[2].length === 3, arguments");
|
||||
|
@ -28,7 +28,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([39, 3, 9]));
|
||||
var sample = new TA([39n, 3n, 9n]);
|
||||
var called = 0;
|
||||
|
||||
var result = sample.findIndex(function() {
|
||||
@ -42,7 +42,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
called = 0;
|
||||
result = sample.findIndex(function(val) {
|
||||
called++;
|
||||
return val === convertToBigInt(9);
|
||||
return val === 9n;
|
||||
});
|
||||
|
||||
assert.sameValue(called, 3, "predicate was called three times");
|
||||
|
@ -27,7 +27,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([1, 2, 3]));
|
||||
var sample = new TA([1n, 2n, 3n]);
|
||||
var called = 0;
|
||||
|
||||
var result = sample.findIndex(function() {
|
||||
|
@ -26,7 +26,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
var thisArg = ["test262", 0, "ecma262", 0];
|
||||
@ -39,17 +39,17 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(thisArg.length, 4, "thisArg.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -37,17 +37,17 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results.length, 3, "results.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7, 8]));
|
||||
var sample = new TA([7n, 8n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -36,6 +36,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
|
||||
assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue");
|
||||
assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue");
|
||||
assert.sameValue(results[0][0], 7n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[1][0], 8n, "results[1][0] - kValue");
|
||||
});
|
||||
|
@ -18,13 +18,13 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample1 = new TA(3);
|
||||
|
||||
sample1[1] = convertToBigInt(1);
|
||||
sample1[1] = 1n;
|
||||
|
||||
sample1.forEach(function() {
|
||||
return 42;
|
||||
});
|
||||
|
||||
assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0");
|
||||
assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1");
|
||||
assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0");
|
||||
assert.sameValue(sample1[0], 0n, "[0] == 0");
|
||||
assert.sameValue(sample1[1], 1n, "[1] == 1");
|
||||
assert.sameValue(sample1[2], 0n, "[2] == 0");
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ features: [BigInt, Reflect.set, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
var newVal = 0;
|
||||
|
||||
sample.forEach(function(val, i) {
|
||||
@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
"get the changed value during the loop"
|
||||
);
|
||||
assert.sameValue(
|
||||
Reflect.set(sample, 0, convertToBigInt(7)),
|
||||
Reflect.set(sample, 0, 7n),
|
||||
true,
|
||||
"re-set a value for sample[0]"
|
||||
);
|
||||
@ -41,7 +41,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
newVal++;
|
||||
});
|
||||
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7");
|
||||
assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1");
|
||||
assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2");
|
||||
assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
|
||||
assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
|
||||
assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
|
||||
});
|
||||
|
@ -17,15 +17,15 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
sample.forEach(function(v, i) {
|
||||
if (i < sample.length - 1) {
|
||||
sample[i+1] = convertToBigInt(42);
|
||||
sample[i+1] = 42n;
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
v, convertToBigInt(42), "method does not cache values before callbackfn calls"
|
||||
v, 42n, "method does not cache values before callbackfn calls"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -30,15 +30,15 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 43, 41]));
|
||||
var sample = new TA([42n, 43n, 43n, 41n]);
|
||||
|
||||
assert.sameValue(
|
||||
sample.includes(convertToBigInt(43), Infinity),
|
||||
sample.includes(43n, Infinity),
|
||||
false,
|
||||
"includes(43, Infinity)"
|
||||
);
|
||||
assert.sameValue(
|
||||
sample.includes(convertToBigInt(43), -Infinity),
|
||||
sample.includes(43n, -Infinity),
|
||||
true,
|
||||
"includes(43, -Infinity)");
|
||||
});
|
||||
|
@ -27,8 +27,8 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43]));
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), -0), true, "-0 [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), -0), true, "-0 [1]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(44), -0), false, "-0 [2]");
|
||||
sample = new TA([42n, 43n]);
|
||||
assert.sameValue(sample.includes(42n, -0), true, "-0 [0]");
|
||||
assert.sameValue(sample.includes(43n, -0), true, "-0 [1]");
|
||||
assert.sameValue(sample.includes(44n, -0), false, "-0 [2]");
|
||||
});
|
||||
|
@ -24,10 +24,10 @@ features: [BigInt, TypedArray]
|
||||
Object.defineProperty(TypedArray.prototype, "length", {value: 0});
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7]));
|
||||
var sample = new TA([7n]);
|
||||
|
||||
Object.defineProperty(TA.prototype, "length", {value: 0});
|
||||
Object.defineProperty(sample, "length", {value: 0});
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(7)), true);
|
||||
assert.sameValue(sample.includes(7n), true);
|
||||
});
|
||||
|
@ -25,9 +25,9 @@ features: [BigInt, Symbol, TypedArray]
|
||||
var fromIndex = Symbol("1");
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7]));
|
||||
var sample = new TA([7n]);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
sample.includes(convertToBigInt(7), fromIndex);
|
||||
sample.includes(7n, fromIndex);
|
||||
});
|
||||
});
|
||||
|
@ -29,9 +29,9 @@ var fromIndex = {
|
||||
};
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7]));
|
||||
var sample = new TA([7n]);
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
sample.includes(convertToBigInt(7), fromIndex);
|
||||
sample.includes(7n, fromIndex);
|
||||
});
|
||||
});
|
||||
|
@ -30,15 +30,15 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 42, 41]));
|
||||
assert.sameValue(sample.includes(convertToBigInt(42)), true, "includes(42)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43)), true, "includes(43)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), 1), true, "includes(43, 1)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), 1), true, "includes(42, 1)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), 2), true, "includes(42, 2)");
|
||||
var sample = new TA([42n, 43n, 42n, 41n]);
|
||||
assert.sameValue(sample.includes(42n), true, "includes(42)");
|
||||
assert.sameValue(sample.includes(43n), true, "includes(43)");
|
||||
assert.sameValue(sample.includes(43n, 1), true, "includes(43, 1)");
|
||||
assert.sameValue(sample.includes(42n, 1), true, "includes(42, 1)");
|
||||
assert.sameValue(sample.includes(42n, 2), true, "includes(42, 2)");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), -4), true, "includes(42, -4)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), -3), true, "includes(42, -3)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), -2), true, "includes(42, -2)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), -5), true, "includes(42, -5)");
|
||||
assert.sameValue(sample.includes(42n, -4), true, "includes(42, -4)");
|
||||
assert.sameValue(sample.includes(42n, -3), true, "includes(42, -3)");
|
||||
assert.sameValue(sample.includes(42n, -2), true, "includes(42, -2)");
|
||||
assert.sameValue(sample.includes(42n, -5), true, "includes(42, -5)");
|
||||
});
|
||||
|
@ -32,11 +32,11 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43, 42, 41]));
|
||||
assert.sameValue(sample.includes(convertToBigInt(44)), false, "includes(44)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), 2), false, "includes(43, 2)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), 3), false, "includes(42, 3)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(44), -4), false, "includes(44, -4)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(44), -5), false, "includes(44, -5)");
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), -1), false, "includes(42, -1)");
|
||||
sample = new TA([42n, 43n, 42n, 41n]);
|
||||
assert.sameValue(sample.includes(44n), false, "includes(44)");
|
||||
assert.sameValue(sample.includes(43n, 2), false, "includes(43, 2)");
|
||||
assert.sameValue(sample.includes(42n, 3), false, "includes(42, 3)");
|
||||
assert.sameValue(sample.includes(44n, -4), false, "includes(44, -4)");
|
||||
assert.sameValue(sample.includes(44n, -5), false, "includes(44, -5)");
|
||||
assert.sameValue(sample.includes(42n, -1), false, "includes(42, -1)");
|
||||
});
|
||||
|
@ -38,28 +38,28 @@ var obj = {
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43]));
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), "1"), false, "string [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), "1"), true, "string [1]");
|
||||
sample = new TA([42n, 43n]);
|
||||
assert.sameValue(sample.includes(42n, "1"), false, "string [0]");
|
||||
assert.sameValue(sample.includes(43n, "1"), true, "string [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), true), false, "true [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), true), true, "true [1]");
|
||||
assert.sameValue(sample.includes(42n, true), false, "true [0]");
|
||||
assert.sameValue(sample.includes(43n, true), true, "true [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), false), true, "false [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), false), true, "false [1]");
|
||||
assert.sameValue(sample.includes(42n, false), true, "false [0]");
|
||||
assert.sameValue(sample.includes(43n, false), true, "false [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), NaN), true, "NaN [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), NaN), true, "NaN [1]");
|
||||
assert.sameValue(sample.includes(42n, NaN), true, "NaN [0]");
|
||||
assert.sameValue(sample.includes(43n, NaN), true, "NaN [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), null), true, "null [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), null), true, "null [1]");
|
||||
assert.sameValue(sample.includes(42n, null), true, "null [0]");
|
||||
assert.sameValue(sample.includes(43n, null), true, "null [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), undefined), true, "undefined [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), undefined), true, "undefined [1]");
|
||||
assert.sameValue(sample.includes(42n, undefined), true, "undefined [0]");
|
||||
assert.sameValue(sample.includes(43n, undefined), true, "undefined [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), null), true, "null [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), null), true, "null [1]");
|
||||
assert.sameValue(sample.includes(42n, null), true, "null [0]");
|
||||
assert.sameValue(sample.includes(43n, null), true, "null [1]");
|
||||
|
||||
assert.sameValue(sample.includes(convertToBigInt(42), obj), false, "object [0]");
|
||||
assert.sameValue(sample.includes(convertToBigInt(43), obj), true, "object [1]");
|
||||
assert.sameValue(sample.includes(42n, obj), false, "object [0]");
|
||||
assert.sameValue(sample.includes(43n, obj), true, "object [1]");
|
||||
});
|
||||
|
@ -32,8 +32,8 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 43, 41]));
|
||||
var sample = new TA([42n, 43n, 43n, 41n]);
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), Infinity), -1, "indexOf(43, Infinity)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), -Infinity), 1, "indexOf(43, -Infinity)");
|
||||
assert.sameValue(sample.indexOf(43n, Infinity), -1, "indexOf(43, Infinity)");
|
||||
assert.sameValue(sample.indexOf(43n, -Infinity), 1, "indexOf(43, -Infinity)");
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43]));
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), -0), 0, "-0 [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), -0), 1, "-0 [1]");
|
||||
sample = new TA([42n, 43n]);
|
||||
assert.sameValue(sample.indexOf(42n, -0), 0, "-0 [0]");
|
||||
assert.sameValue(sample.indexOf(43n, -0), 1, "-0 [1]");
|
||||
});
|
||||
|
@ -23,10 +23,10 @@ features: [BigInt, TypedArray]
|
||||
Object.defineProperty(TypedArray.prototype, "length", {value: 0});
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7]));
|
||||
var sample = new TA([7n]);
|
||||
|
||||
Object.defineProperty(TA.prototype, "length", {value: 0});
|
||||
Object.defineProperty(sample, "length", {value: 0});
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(7)), 0);
|
||||
assert.sameValue(sample.indexOf(7n), 0);
|
||||
});
|
||||
|
@ -32,15 +32,15 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 42, 41]));
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42)), 0, "indexOf(42)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43)), 1, "indexOf(43)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), 1), 1, "indexOf(43, 1)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), 1), 2, "indexOf(42, 1)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), 2), 2, "indexOf(42, 2)");
|
||||
var sample = new TA([42n, 43n, 42n, 41n]);
|
||||
assert.sameValue(sample.indexOf(42n), 0, "indexOf(42)");
|
||||
assert.sameValue(sample.indexOf(43n), 1, "indexOf(43)");
|
||||
assert.sameValue(sample.indexOf(43n, 1), 1, "indexOf(43, 1)");
|
||||
assert.sameValue(sample.indexOf(42n, 1), 2, "indexOf(42, 1)");
|
||||
assert.sameValue(sample.indexOf(42n, 2), 2, "indexOf(42, 2)");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), -4), 0, "indexOf(42, -4)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), -3), 2, "indexOf(42, -3)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), -2), 2, "indexOf(42, -2)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), -5), 0, "indexOf(42, -5)");
|
||||
assert.sameValue(sample.indexOf(42n, -4), 0, "indexOf(42, -4)");
|
||||
assert.sameValue(sample.indexOf(42n, -3), 2, "indexOf(42, -3)");
|
||||
assert.sameValue(sample.indexOf(42n, -2), 2, "indexOf(42, -2)");
|
||||
assert.sameValue(sample.indexOf(42n, -5), 0, "indexOf(42, -5)");
|
||||
});
|
||||
|
@ -28,11 +28,11 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43, 42, 41]));
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(44)), -1, "indexOf(44)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), 2), -1, "indexOf(43, 2)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), 3), -1, "indexOf(42, 3)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(44), -4), -1, "indexOf(44, -4)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(44), -5), -1, "indexOf(44, -5)");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), -1), -1, "indexOf(42, -1)");
|
||||
sample = new TA([42n, 43n, 42n, 41n]);
|
||||
assert.sameValue(sample.indexOf(44n), -1, "indexOf(44)");
|
||||
assert.sameValue(sample.indexOf(43n, 2), -1, "indexOf(43, 2)");
|
||||
assert.sameValue(sample.indexOf(42n, 3), -1, "indexOf(42, 3)");
|
||||
assert.sameValue(sample.indexOf(44n, -4), -1, "indexOf(44, -4)");
|
||||
assert.sameValue(sample.indexOf(44n, -5), -1, "indexOf(44, -5)");
|
||||
assert.sameValue(sample.indexOf(42n, -1), -1, "indexOf(42, -1)");
|
||||
});
|
||||
|
@ -30,28 +30,28 @@ var obj = {
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43]));
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), "1"), -1, "string [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), "1"), 1, "string [1]");
|
||||
sample = new TA([42n, 43n]);
|
||||
assert.sameValue(sample.indexOf(42n, "1"), -1, "string [0]");
|
||||
assert.sameValue(sample.indexOf(43n, "1"), 1, "string [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), true), -1, "true [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), true), 1, "true [1]");
|
||||
assert.sameValue(sample.indexOf(42n, true), -1, "true [0]");
|
||||
assert.sameValue(sample.indexOf(43n, true), 1, "true [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), false), 0, "false [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), false), 1, "false [1]");
|
||||
assert.sameValue(sample.indexOf(42n, false), 0, "false [0]");
|
||||
assert.sameValue(sample.indexOf(43n, false), 1, "false [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), NaN), 0, "NaN [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), NaN), 1, "NaN [1]");
|
||||
assert.sameValue(sample.indexOf(42n, NaN), 0, "NaN [0]");
|
||||
assert.sameValue(sample.indexOf(43n, NaN), 1, "NaN [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), null), 0, "null [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), null), 1, "null [1]");
|
||||
assert.sameValue(sample.indexOf(42n, null), 0, "null [0]");
|
||||
assert.sameValue(sample.indexOf(43n, null), 1, "null [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), undefined), 0, "undefined [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), undefined), 1, "undefined [1]");
|
||||
assert.sameValue(sample.indexOf(42n, undefined), 0, "undefined [0]");
|
||||
assert.sameValue(sample.indexOf(43n, undefined), 1, "undefined [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), null), 0, "null [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), null), 1, "null [1]");
|
||||
assert.sameValue(sample.indexOf(42n, null), 0, "null [0]");
|
||||
assert.sameValue(sample.indexOf(43n, null), 1, "null [1]");
|
||||
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(42), obj), -1, "object [0]");
|
||||
assert.sameValue(sample.indexOf(convertToBigInt(43), obj), 1, "object [1]");
|
||||
assert.sameValue(sample.indexOf(42n, obj), -1, "object [0]");
|
||||
assert.sameValue(sample.indexOf(43n, obj), 1, "object [1]");
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([1, 0, 2, 3, 42, 127]));
|
||||
var sample = new TA([1n, 0n, 2n, 3n, 42n, 127n]);
|
||||
|
||||
var result;
|
||||
|
||||
|
@ -33,7 +33,7 @@ var desc = {
|
||||
Object.defineProperty(TypedArray.prototype, "length", desc);
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43]));
|
||||
var sample = new TA([42n, 43n]);
|
||||
|
||||
Object.defineProperty(TA.prototype, "length", desc);
|
||||
Object.defineProperty(sample, "length", desc);
|
||||
|
@ -29,7 +29,7 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([1, 0, 2, 3, 42, 127]));
|
||||
var sample = new TA([1n, 0n, 2n, 3n, 42n, 127n]);
|
||||
|
||||
var result = sample.join();
|
||||
|
||||
|
@ -18,7 +18,7 @@ features: [BigInt, Symbol.iterator, TypedArray]
|
||||
var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([0, 42, 64]));
|
||||
var sample = new TA([0n, 42n, 64n]);
|
||||
var iter = sample.keys();
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);
|
||||
|
@ -25,8 +25,8 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 43, 41]));
|
||||
var sample = new TA([42n, 43n, 43n, 41n]);
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), Infinity), 2, "lastIndexOf(43, Infinity)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -Infinity), -1, "lastIndexOf(43, -Infinity)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, Infinity), 2, "lastIndexOf(43, Infinity)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -Infinity), -1, "lastIndexOf(43, -Infinity)");
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43]));
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -0), 0, "-0 [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -0), -1, "-0 [1]");
|
||||
sample = new TA([42n, 43n]);
|
||||
assert.sameValue(sample.lastIndexOf(42n, -0), 0, "-0 [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -0), -1, "-0 [1]");
|
||||
});
|
||||
|
@ -23,10 +23,10 @@ features: [BigInt, TypedArray]
|
||||
Object.defineProperty(TypedArray.prototype, "length", {value: 0});
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7]));
|
||||
var sample = new TA([7n]);
|
||||
|
||||
Object.defineProperty(TA.prototype, "length", {value: 0});
|
||||
Object.defineProperty(sample, "length", {value: 0});
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(7)), 0);
|
||||
assert.sameValue(sample.lastIndexOf(7n), 0);
|
||||
});
|
||||
|
@ -31,27 +31,27 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 42, 41]));
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42)), 2, "lastIndexOf(42)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43)), 1, "lastIndexOf(43)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41)), 3, "lastIndexOf(41)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 3), 3, "lastIndexOf(41, 3)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 4), 3, "lastIndexOf(41, 4)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 1), 1, "lastIndexOf(43, 1)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 2), 1, "lastIndexOf(43, 2)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 3), 1, "lastIndexOf(43, 3)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 4), 1, "lastIndexOf(43, 4)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 0), 0, "lastIndexOf(42, 0)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 1), 0, "lastIndexOf(42, 1)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 2), 2, "lastIndexOf(42, 2)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 3), 2, "lastIndexOf(42, 3)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 4), 2, "lastIndexOf(42, 4)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -4), 0, "lastIndexOf(42, -4)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -3), 0, "lastIndexOf(42, -3)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -2), 2, "lastIndexOf(42, -2)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -1), 2, "lastIndexOf(42, -1)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -3), 1, "lastIndexOf(43, -3)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -2), 1, "lastIndexOf(43, -2)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -1), 1, "lastIndexOf(43, -1)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41), -1), 3, "lastIndexOf(41, -1)");
|
||||
var sample = new TA([42n, 43n, 42n, 41n]);
|
||||
assert.sameValue(sample.lastIndexOf(42n), 2, "lastIndexOf(42)");
|
||||
assert.sameValue(sample.lastIndexOf(43n), 1, "lastIndexOf(43)");
|
||||
assert.sameValue(sample.lastIndexOf(41n), 3, "lastIndexOf(41)");
|
||||
assert.sameValue(sample.lastIndexOf(41n, 3), 3, "lastIndexOf(41, 3)");
|
||||
assert.sameValue(sample.lastIndexOf(41n, 4), 3, "lastIndexOf(41, 4)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, 1), 1, "lastIndexOf(43, 1)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, 2), 1, "lastIndexOf(43, 2)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, 3), 1, "lastIndexOf(43, 3)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, 4), 1, "lastIndexOf(43, 4)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, 0), 0, "lastIndexOf(42, 0)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, 1), 0, "lastIndexOf(42, 1)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, 2), 2, "lastIndexOf(42, 2)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, 3), 2, "lastIndexOf(42, 3)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, 4), 2, "lastIndexOf(42, 4)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, -4), 0, "lastIndexOf(42, -4)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, -3), 0, "lastIndexOf(42, -3)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, -2), 2, "lastIndexOf(42, -2)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, -1), 2, "lastIndexOf(42, -1)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -3), 1, "lastIndexOf(43, -3)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -2), 1, "lastIndexOf(43, -2)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -1), 1, "lastIndexOf(43, -1)");
|
||||
assert.sameValue(sample.lastIndexOf(41n, -1), 3, "lastIndexOf(41, -1)");
|
||||
});
|
||||
|
@ -28,15 +28,15 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43, 42, 41]));
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(44)), -1, "lastIndexOf(44)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(44), -4), -1, "lastIndexOf(44, -4)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(44), -5), -1, "lastIndexOf(44, -5)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -5), -1, "lastIndexOf(42, -5)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -4), -1, "lastIndexOf(43, -4)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -5), -1, "lastIndexOf(43, -5)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 0), -1, "lastIndexOf(41, 0)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 1), -1, "lastIndexOf(41, 1)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 2), -1, "lastIndexOf(41, 2)");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 0), -1, "lastIndexOf(43, 0)");
|
||||
sample = new TA([42n, 43n, 42n, 41n]);
|
||||
assert.sameValue(sample.lastIndexOf(44n), -1, "lastIndexOf(44)");
|
||||
assert.sameValue(sample.lastIndexOf(44n, -4), -1, "lastIndexOf(44, -4)");
|
||||
assert.sameValue(sample.lastIndexOf(44n, -5), -1, "lastIndexOf(44, -5)");
|
||||
assert.sameValue(sample.lastIndexOf(42n, -5), -1, "lastIndexOf(42, -5)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -4), -1, "lastIndexOf(43, -4)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, -5), -1, "lastIndexOf(43, -5)");
|
||||
assert.sameValue(sample.lastIndexOf(41n, 0), -1, "lastIndexOf(41, 0)");
|
||||
assert.sameValue(sample.lastIndexOf(41n, 1), -1, "lastIndexOf(41, 1)");
|
||||
assert.sameValue(sample.lastIndexOf(41n, 2), -1, "lastIndexOf(41, 2)");
|
||||
assert.sameValue(sample.lastIndexOf(43n, 0), -1, "lastIndexOf(43, 0)");
|
||||
});
|
||||
|
@ -30,28 +30,28 @@ var obj = {
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample;
|
||||
|
||||
sample = new TA(convertToBigInt([42, 43]));
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), "1"), 0, "string [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), "1"), 1, "string [1]");
|
||||
sample = new TA([42n, 43n]);
|
||||
assert.sameValue(sample.lastIndexOf(42n, "1"), 0, "string [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, "1"), 1, "string [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), true), 0, "true [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), true), 1, "true [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, true), 0, "true [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, true), 1, "true [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), false), 0, "false [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), false), -1, "false [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, false), 0, "false [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, false), -1, "false [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), NaN), 0, "NaN [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), NaN), -1, "NaN [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, NaN), 0, "NaN [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, NaN), -1, "NaN [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), null), 0, "null [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), null), -1, "null [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, null), 0, "null [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, null), -1, "null [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), undefined), 0, "undefined [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), undefined), -1, "undefined [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, undefined), 0, "undefined [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, undefined), -1, "undefined [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), null), 0, "null [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), null), -1, "null [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, null), 0, "null [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, null), -1, "null [1]");
|
||||
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(42), obj), 0, "object [0]");
|
||||
assert.sameValue(sample.lastIndexOf(convertToBigInt(43), obj), 1, "object [1]");
|
||||
assert.sameValue(sample.lastIndexOf(42n, obj), 0, "object [0]");
|
||||
assert.sameValue(sample.lastIndexOf(43n, obj), 1, "object [1]");
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
sample1.map(function() {
|
||||
loop++;
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
assert.sameValue(loop, 42, "data descriptor");
|
||||
|
||||
@ -38,7 +38,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
sample2.map(function() {
|
||||
loop++;
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
assert.sameValue(loop, 4, "accessor descriptor");
|
||||
});
|
||||
|
@ -18,31 +18,31 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
var thisArg = ["test262", 0, "ecma262", 0];
|
||||
|
||||
sample.map(function() {
|
||||
results.push(arguments);
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
}, thisArg);
|
||||
|
||||
assert.sameValue(results.length, 3, "results.length");
|
||||
assert.sameValue(thisArg.length, 4, "thisArg.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -18,29 +18,29 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
sample.map(function() {
|
||||
results.push(arguments);
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
|
||||
assert.sameValue(results.length, 3, "results.length");
|
||||
|
||||
assert.sameValue(results[0].length, 3, "results[0].length");
|
||||
assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][0], 42n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[0][2], sample, "results[0][2] - this");
|
||||
|
||||
assert.sameValue(results[1].length, 3, "results[1].length");
|
||||
assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][0], 43n, "results[1][0] - kValue");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
assert.sameValue(results[1][2], sample, "results[1][2] - this");
|
||||
|
||||
assert.sameValue(results[2].length, 3, "results[2].length");
|
||||
assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][0], 44n, "results[2][0] - kValue");
|
||||
assert.sameValue(results[2][1], 2, "results[2][1] - k");
|
||||
assert.sameValue(results[2][2], sample, "results[2][2] - this");
|
||||
});
|
||||
|
@ -28,7 +28,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
}
|
||||
$DETACHBUFFER(sample.buffer);
|
||||
loops++;
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -19,7 +19,7 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7, 8]));
|
||||
var sample = new TA([7n, 8n]);
|
||||
|
||||
var results = [];
|
||||
|
||||
@ -28,7 +28,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
sample.map(function() {
|
||||
results.push(arguments);
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
|
||||
assert.sameValue(results.length, 2, "results.length");
|
||||
@ -36,6 +36,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(results[0][1], 0, "results[0][1] - k");
|
||||
assert.sameValue(results[1][1], 1, "results[1][1] - k");
|
||||
|
||||
assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue");
|
||||
assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue");
|
||||
assert.sameValue(results[0][0], 7n, "results[0][0] - kValue");
|
||||
assert.sameValue(results[1][0], 8n, "results[1][0] - kValue");
|
||||
});
|
||||
|
@ -20,12 +20,12 @@ features: [BigInt, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([1, 2, 4]));
|
||||
var sample = new TA([1n, 2n, 4n]);
|
||||
var result = sample.map(function(v) {
|
||||
return v * convertToBigInt(3);
|
||||
return v * 3n;
|
||||
});
|
||||
|
||||
assert.sameValue(result[0], convertToBigInt(3), "result[0] == 3");
|
||||
assert.sameValue(result[1], convertToBigInt(6), "result[1] == 6");
|
||||
assert.sameValue(result[2], convertToBigInt(12), "result[2] == 12");
|
||||
assert.sameValue(result[0], 3n, "result[0] == 3");
|
||||
assert.sameValue(result[1], 6n, "result[1] == 6");
|
||||
assert.sameValue(result[2], 12n, "result[2] == 12");
|
||||
});
|
||||
|
@ -13,13 +13,13 @@ features: [BigInt, TypedArray]
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample1 = new TA(3);
|
||||
|
||||
sample1[1] = convertToBigInt(1);
|
||||
sample1[1] = 1n;
|
||||
|
||||
sample1.map(function() {
|
||||
return convertToBigInt(42);
|
||||
return 42n;
|
||||
});
|
||||
|
||||
assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0");
|
||||
assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1");
|
||||
assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0");
|
||||
assert.sameValue(sample1[0], 0n, "[0] == 0");
|
||||
assert.sameValue(sample1[1], 1n, "[1] == 1");
|
||||
assert.sameValue(sample1[2], 0n, "[2] == 0");
|
||||
});
|
||||
|
@ -18,14 +18,14 @@ features: [BigInt, Symbol, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([7, 8]));
|
||||
var sample = new TA([7n, 8n]);
|
||||
var bar = Symbol("1");
|
||||
|
||||
sample.foo = 42;
|
||||
sample[bar] = 1;
|
||||
|
||||
var result = sample.map(function() {
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
|
||||
assert.sameValue(result.length, 2, "result.length");
|
||||
|
@ -12,7 +12,7 @@ features: [BigInt, Reflect.set, TypedArray]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
var sample = new TA(convertToBigInt([42, 43, 44]));
|
||||
var sample = new TA([42n, 43n, 44n]);
|
||||
var newVal = 0;
|
||||
|
||||
sample.map(function(val, i) {
|
||||
@ -22,7 +22,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
"get the changed value during the loop"
|
||||
);
|
||||
assert.sameValue(
|
||||
Reflect.set(sample, 0, convertToBigInt(7)),
|
||||
Reflect.set(sample, 0, 7n),
|
||||
true,
|
||||
"re-set a value for sample[0]"
|
||||
);
|
||||
@ -34,10 +34,10 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
);
|
||||
|
||||
newVal++;
|
||||
return convertToBigInt(0);
|
||||
return 0n;
|
||||
});
|
||||
|
||||
assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7");
|
||||
assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1");
|
||||
assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2");
|
||||
assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7");
|
||||
assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1");
|
||||
assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2");
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user