Remove N()

This commit is contained in:
Leo Balter 2018-02-15 13:00:09 -05:00
parent 3f3f2faa8e
commit 098c69540e
209 changed files with 1219 additions and 1221 deletions

View File

@ -41,11 +41,9 @@ var TypedArray = Object.getPrototypeOf(Int8Array);
function testWithTypedArrayConstructors(f, selected) { function testWithTypedArrayConstructors(f, selected) {
var constructors = selected || typedArrayConstructors; var constructors = selected || typedArrayConstructors;
for (var i = 0; i < constructors.length; ++i) { for (var i = 0; i < constructors.length; ++i) {
// TODO: Remove this
var N = function(x) { return x; };
var constructor = constructors[i]; var constructor = constructors[i];
try { try {
f(constructor, N); f(constructor);
} catch (e) { } catch (e) {
e.message += " (Testing with " + constructor.name + ".)"; e.message += " (Testing with " + constructor.name + ".)";
throw e; throw e;
@ -77,5 +75,5 @@ function testTypedArrayConversions(byteConversionValues, fn) {
} }
fn(TA, value, exp, initial); fn(TA, value, exp, initial);
}); });
}, numericTypedArrayConstructors); });
} }

View File

@ -26,51 +26,51 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, null), new TA([0, 1, 2, 3]).copyWithin(1, 0, null),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'null value coerced to 0' 'null value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, NaN), new TA([0, 1, 2, 3]).copyWithin(1, 0, NaN),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'NaN value coerced to 0' 'NaN value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, false), new TA([0, 1, 2, 3]).copyWithin(1, 0, false),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'false value coerced to 0' 'false value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, true), new TA([0, 1, 2, 3]).copyWithin(1, 0, true),
N([0, 0, 2, 3]) [0, 0, 2, 3]
), ),
'true value coerced to 1' 'true value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, '-2'), new TA([0, 1, 2, 3]).copyWithin(1, 0, '-2'),
N([0, 0, 1, 3]) [0, 0, 1, 3]
), ),
'string "-2" value coerced to integer -2' 'string "-2" value coerced to integer -2'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, -2.5), new TA([0, 1, 2, 3]).copyWithin(1, 0, -2.5),
N([0, 0, 1, 3]) [0, 0, 1, 3]
), ),
'float -2.5 value coerced to integer -2' 'float -2.5 value coerced to integer -2'
); );

View File

@ -25,67 +25,67 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, undefined), new TA([0, 1, 2, 3]).copyWithin(1, undefined),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'undefined value coerced to 0' 'undefined value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, false), new TA([0, 1, 2, 3]).copyWithin(1, false),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'false value coerced to 0' 'false value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, NaN), new TA([0, 1, 2, 3]).copyWithin(1, NaN),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'NaN value coerced to 0' 'NaN value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, null), new TA([0, 1, 2, 3]).copyWithin(1, null),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'null value coerced to 0' 'null value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, true), new TA([0, 1, 2, 3]).copyWithin(0, true),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'true value coerced to 1' 'true value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, '1'), new TA([0, 1, 2, 3]).copyWithin(0, '1'),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'string "1" value coerced to 1' 'string "1" value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0.5), new TA([0, 1, 2, 3]).copyWithin(1, 0.5),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'0.5 float value coerced to integer 0' '0.5 float value coerced to integer 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1.5), new TA([0, 1, 2, 3]).copyWithin(0, 1.5),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'1.5 float value coerced to integer 1' '1.5 float value coerced to integer 1'
); );

View File

@ -25,67 +25,67 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(undefined, 1), new TA([0, 1, 2, 3]).copyWithin(undefined, 1),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'undefined value coerced to 0' 'undefined value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(false, 1), new TA([0, 1, 2, 3]).copyWithin(false, 1),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'false value coerced to 0' 'false value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(NaN, 1), new TA([0, 1, 2, 3]).copyWithin(NaN, 1),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'NaN value coerced to 0' 'NaN value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(null, 1), new TA([0, 1, 2, 3]).copyWithin(null, 1),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'null value coerced to 0' 'null value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(true, 0), new TA([0, 1, 2, 3]).copyWithin(true, 0),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'true value coerced to 1' 'true value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin('1', 0), new TA([0, 1, 2, 3]).copyWithin('1', 0),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'string "1" value coerced to 1' 'string "1" value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0.5, 1), new TA([0, 1, 2, 3]).copyWithin(0.5, 1),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'0.5 float value coerced to integer 0' '0.5 float value coerced to integer 0'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1.5, 0), new TA([0, 1, 2, 3]).copyWithin(1.5, 0),
N([0, 0, 1, 2]) [0, 0, 1, 2]
), ),
'1.5 float value coerced to integer 1' '1.5 float value coerced to integer 1'
); );

View File

@ -28,67 +28,67 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1, -1), new TA([0, 1, 2, 3]).copyWithin(0, 1, -1),
N([1, 2, 2, 3]) [1, 2, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(2, 0, -1), new TA([0, 1, 2, 3, 4]).copyWithin(2, 0, -1),
N([0, 1, 0, 1, 2]) [0, 1, 0, 1, 2]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]' '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(1, 2, -2), new TA([0, 1, 2, 3, 4]).copyWithin(1, 2, -2),
N([0, 2, 2, 3, 4]) [0, 2, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, -2, -1), new TA([0, 1, 2, 3]).copyWithin(0, -2, -1),
N([2, 1, 2, 3]) [2, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -2, -1), new TA([0, 1, 2, 3, 4]).copyWithin(2, -2, -1),
N([0, 1, 3, 3, 4]) [0, 1, 3, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-3, -2, -1), new TA([0, 1, 2, 3]).copyWithin(-3, -2, -1),
N([0, 2, 2, 3]) [0, 2, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]' '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, -3, -1), new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3, -1),
N([0, 1, 2, 2, 3]) [0, 1, 2, 2, 3]
), ),
'[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]' '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(-5, -2, -1), new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2, -1),
N([3, 1, 2, 3, 4]) [3, 1, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]'
); );

View File

@ -28,83 +28,83 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1, -10), new TA([0, 1, 2, 3]).copyWithin(0, 1, -10),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(0, 1, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, -2, -10), new TA([0, 1, 2, 3]).copyWithin(0, -2, -10),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -2, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(0, -2, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, -9, -10), new TA([0, 1, 2, 3]).copyWithin(0, -9, -10),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -9, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(0, -9, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-3, -2, -10), new TA([0, 1, 2, 3]).copyWithin(-3, -2, -10),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(-3, -2, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(-3, -2, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-7, -8, -9), new TA([0, 1, 2, 3]).copyWithin(-7, -8, -9),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(-7, -8, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(-7, -8, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]'
); );

View File

@ -26,67 +26,67 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, -10), new TA([0, 1, 2, 3]).copyWithin(0, -10),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(0, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -10), new TA([0, 1, 2, 3, 4]).copyWithin(2, -10),
N([0, 1, 0, 1, 2]) [0, 1, 0, 1, 2]
), ),
'[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]' '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(2, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(2, -Infinity),
N([1, 2, 1, 2, 3]) [1, 2, 1, 2, 3]
), ),
'[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(10, -10), new TA([0, 1, 2, 3, 4]).copyWithin(10, -10),
N([0, 1, 2, 3, 4]) [0, 1, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]' '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(10, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(10, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-9, -10), new TA([0, 1, 2, 3]).copyWithin(-9, -10),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(-9, -Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(-9, -Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]'
); );

View File

@ -26,35 +26,35 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-10, 0), new TA([0, 1, 2, 3]).copyWithin(-10, 0),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(-Infinity, 0), new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 0),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(-10, 2), new TA([0, 1, 2, 3, 4]).copyWithin(-10, 2),
N([2, 3, 4, 3, 4]) [2, 3, 4, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(-Infinity, 2), new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 2),
N([3, 4, 5, 4, 5]) [3, 4, 5, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]'
); );

View File

@ -26,51 +26,51 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, -1), new TA([0, 1, 2, 3]).copyWithin(0, -1),
N([3, 1, 2, 3]) [3, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -2), new TA([0, 1, 2, 3, 4]).copyWithin(2, -2),
N([0, 1, 3, 4, 4]) [0, 1, 3, 4, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]' '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(1, -2), new TA([0, 1, 2, 3, 4]).copyWithin(1, -2),
N([0, 3, 4, 3, 4]) [0, 3, 4, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-1, -2), new TA([0, 1, 2, 3]).copyWithin(-1, -2),
N([0, 1, 2, 2]) [0, 1, 2, 2]
), ),
'[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]' '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, -3), new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3),
N([0, 1, 2, 2, 3]) [0, 1, 2, 2, 3]
), ),
'[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]' '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(-5, -2), new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2),
N([3, 4, 2, 3, 4]) [3, 4, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]'
); );

View File

@ -26,27 +26,27 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-1, 0), new TA([0, 1, 2, 3]).copyWithin(-1, 0),
N([0, 1, 2, 0]) [0, 1, 2, 0]
), ),
'[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, 2), new TA([0, 1, 2, 3, 4]).copyWithin(-2, 2),
N([0, 1, 2, 2, 3]) [0, 1, 2, 2, 3]
), ),
'[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]' '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(-1, 2), new TA([0, 1, 2, 3]).copyWithin(-1, 2),
N([0, 1, 2, 2]) [0, 1, 2, 2]
), ),
'[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]'
); );

View File

@ -19,35 +19,35 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1, 6), new TA([0, 1, 2, 3]).copyWithin(0, 1, 6),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(0, 1, Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, Infinity),
N([2, 3, 4, 5, 5]) [2, 3, 4, 5, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]' '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 6), new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 6),
N([0, 3, 4, 5, 4, 5]) [0, 3, 4, 5, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(1, 3, Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(1, 3, Infinity),
N([1, 4, 5, 4, 5]) [1, 4, 5, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]'
); );

View File

@ -19,55 +19,55 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(6, 0), new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0),
N([0, 1, 2, 3, 4, 5]) [0, 1, 2, 3, 4, 5]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(Infinity, 0), new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, 0),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(0, 6), new TA([0, 1, 2, 3, 4, 5]).copyWithin(0, 6),
N([0, 1, 2, 3, 4, 5]) [0, 1, 2, 3, 4, 5]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(0, Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(0, Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(6, 6), new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 6),
N([0, 1, 2, 3, 4, 5]) [0, 1, 2, 3, 4, 5]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(10, 10), new TA([0, 1, 2, 3, 4, 5]).copyWithin(10, 10),
N([0, 1, 2, 3, 4, 5]) [0, 1, 2, 3, 4, 5]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5])).copyWithin(Infinity, Infinity), new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, Infinity),
N([1, 2, 3, 4, 5]) [1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]'
); );

View File

@ -19,32 +19,32 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(0, 0), new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 0),
N([1, 2, 3, 4, 5, 6]) [1, 2, 3, 4, 5, 6]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(0, 2), new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 2),
N([3, 4, 5, 6, 5, 6]) [3, 4, 5, 6, 5, 6]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(3, 0), new TA([1, 2, 3, 4, 5, 6]).copyWithin(3, 0),
N([1, 2, 3, 1, 2, 3]) [1, 2, 3, 1, 2, 3]
) )
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 4), new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 4),
N([0, 4, 5, 3, 4, 5]) [0, 4, 5, 3, 4, 5]
) )
); );
}); });

View File

@ -19,27 +19,27 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 0, 0), new TA([0, 1, 2, 3]).copyWithin(0, 0, 0),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 0, 2), new TA([0, 1, 2, 3]).copyWithin(0, 0, 2),
N([0, 1, 2, 3]) [0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1, 2), new TA([0, 1, 2, 3]).copyWithin(0, 1, 2),
N([1, 1, 2, 3]) [1, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]'
); );
@ -57,16 +57,16 @@ testWithTypedArrayConstructors(function(TA, N) {
*/ */
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(1, 0, 2), new TA([0, 1, 2, 3]).copyWithin(1, 0, 2),
N([0, 0, 1, 3]) [0, 0, 1, 3]
), ),
'[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 5), new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 5),
N([0, 3, 4, 3, 4, 5]) [0, 3, 4, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]'
); );

View File

@ -23,13 +23,13 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample1 = new TA(); var sample1 = new TA();
var result1 = sample1.copyWithin(0, 0); var result1 = sample1.copyWithin(0, 0);
assert.sameValue(result1, sample1); assert.sameValue(result1, sample1);
var sample2 = new TA(N([1, 2, 3])); var sample2 = new TA([1, 2, 3]);
var result2 = sample2.copyWithin(1, 0); var result2 = sample2.copyWithin(1, 0);
assert.sameValue(result2, sample2); assert.sameValue(result2, sample2);

View File

@ -26,19 +26,19 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1, undefined), new TA([0, 1, 2, 3]).copyWithin(0, 1, undefined),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
new TA(N([0, 1, 2, 3])).copyWithin(0, 1), new TA([0, 1, 2, 3]).copyWithin(0, 1),
N([1, 2, 3, 3]) [1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]'
); );

View File

@ -16,8 +16,8 @@ features: [Symbol.iterator, TypedArray]
var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([0, 42, 64])); var sample = new TA([0, 42, 64]);
var iter = sample.entries(); var iter = sample.entries();
assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);

View File

@ -14,20 +14,20 @@ features: [TypedArray]
var sample = [0, 42, 64]; var sample = [0, 42, 64];
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var typedArray = new TA(N(sample)); var typedArray = new TA(sample);
var itor = typedArray.entries(); var itor = typedArray.entries();
var next = itor.next(); var next = itor.next();
assert(compareArray(next.value, [0, N(0)])); assert(compareArray(next.value, [0, 0]));
assert.sameValue(next.done, false); assert.sameValue(next.done, false);
next = itor.next(); next = itor.next();
assert(compareArray(next.value, [1, N(42)])); assert(compareArray(next.value, [1, 42]));
assert.sameValue(next.done, false); assert.sameValue(next.done, false);
next = itor.next(); next = itor.next();
assert(compareArray(next.value, [2, N(64)])); assert(compareArray(next.value, [2, 64]));
assert.sameValue(next.done, false); assert.sameValue(next.done, false);
next = itor.next(); next = itor.next();

View File

@ -25,8 +25,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
var thisArg = ["test262", 0, "ecma262", 0]; var thisArg = ["test262", 0, "ecma262", 0];
@ -40,17 +40,17 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(thisArg.length, 4, "thisArg.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -25,8 +25,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
@ -38,17 +38,17 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results.length, 3, "results.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -18,8 +18,8 @@ includes: [testTypedArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7, 8])); var sample = new TA([7, 8]);
var results = []; var results = [];
@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[0][1], 0, "results[0][1] - key");
assert.sameValue(results[1][1], 1, "results[1][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key");
assert.sameValue(results[0][0], N(7), "results[0][0] - value"); assert.sameValue(results[0][0], 7, "results[0][0] - value");
assert.sameValue(results[1][0], N(8), "results[1][0] - value"); assert.sameValue(results[1][0], 8, "results[1][0] - value");
}); });

View File

@ -25,14 +25,14 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42])); var sample = new TA([40, 41, 42]);
sample.every(function() { sample.every(function() {
return 43; return 43;
}); });
assert.sameValue(sample[0], N(40), "[0] == 40"); assert.sameValue(sample[0], 40, "[0] == 40");
assert.sameValue(sample[1], N(41), "[1] == 41"); assert.sameValue(sample[1], 41, "[1] == 41");
assert.sameValue(sample[2], N(42), "[2] == 42"); assert.sameValue(sample[2], 42, "[2] == 42");
}); });

View File

@ -25,24 +25,24 @@ includes: [testTypedArray.js]
features: [Reflect.set, TypedArray] features: [Reflect.set, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var newVal = 0; var newVal = 0;
sample.every(function(val, i) { sample.every(function(val, i) {
if (i > 0) { if (i > 0) {
assert.sameValue( assert.sameValue(
sample[i - 1], N(newVal - 1), sample[i - 1], newVal - 1,
"get the changed value during the loop" "get the changed value during the loop"
); );
assert.sameValue( assert.sameValue(
Reflect.set(sample, 0, N(7)), Reflect.set(sample, 0, 7),
true, true,
"re-set a value for sample[0]" "re-set a value for sample[0]"
); );
} }
assert.sameValue( assert.sameValue(
Reflect.set(sample, i, N(newVal)), Reflect.set(sample, i, newVal),
true, true,
"set value during iteration" "set value during iteration"
); );
@ -52,7 +52,7 @@ testWithTypedArrayConstructors(function(TA, N) {
return true; return true;
}); });
assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7");
assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1");
assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2");
}); });

View File

@ -30,8 +30,8 @@ var desc = {
Object.defineProperty(TypedArray.prototype, "length", desc); Object.defineProperty(TypedArray.prototype, "length", desc);
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43])); var sample = new TA([42, 43]);
var calls = 0; var calls = 0;
Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(TA.prototype, "length", desc);

View File

@ -26,16 +26,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
sample.every(function(v, i) { sample.every(function(v, i) {
if (i < sample.length - 1) { if (i < sample.length - 1) {
sample[i+1] = N(42); sample[i+1] = 42;
} }
assert.sameValue( assert.sameValue(
v, N(42), "method does not cache values before callbackfn calls" v, 42, "method does not cache values before callbackfn calls"
); );
return true; return true;
}); });

View File

@ -31,74 +31,74 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), undefined), N([1, 1])), compareArray(new TA([0, 0])).fill(1, undefined), [1, 1],
'`undefined` start coerced to 0' '`undefined` start coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, undefined), N([1, 1])), compareArray(new TA([0, 0])).fill(1, 0, undefined), [1, 1],
'If end is undefined, let relativeEnd be len' 'If end is undefined, let relativeEnd be len'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), null), N([1, 1])), compareArray(new TA([0, 0])).fill(1, null), [1, 1],
'`null` start coerced to 0' '`null` start coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, null), N([0, 0])), compareArray(new TA([0, 0])).fill(1, 0, null), [0, 0],
'`null` end coerced to 0' '`null` end coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), true), N([0, 1])), compareArray(new TA([0, 0])).fill(1, true), [0, 1],
'`true` start coerced to 1' '`true` start coerced to 1'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, true), N([1, 0])), compareArray(new TA([0, 0])).fill(1, 0, true), [1, 0],
'`true` end coerced to 1' '`true` end coerced to 1'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), false), N([1, 1])), compareArray(new TA([0, 0])).fill(1, false), [1, 1],
'`false` start coerced to 0' '`false` start coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, false), N([0, 0])), compareArray(new TA([0, 0])).fill(1, 0, false), [0, 0],
'`false` end coerced to 0' '`false` end coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), NaN), N([1, 1])), compareArray(new TA([0, 0])).fill(1, NaN), [1, 1],
'`NaN` start coerced to 0' '`NaN` start coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, NaN), N([0, 0])), compareArray(new TA([0, 0])).fill(1, 0, NaN), [0, 0],
'`NaN` end coerced to 0' '`NaN` end coerced to 0'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), '1'), N([0, 1])), compareArray(new TA([0, 0])).fill(1, '1'), [0, 1],
'string start coerced' 'string start coerced'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, '1'), N([1, 0])), compareArray(new TA([0, 0])).fill(1, 0, '1'), [1, 0],
'string end coerced' 'string end coerced'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 1.5), N([0, 1])), compareArray(new TA([0, 0])).fill(1, 1.5), [0, 1],
'start as a float number coerced' 'start as a float number coerced'
); );
assert( assert(
compareArray(new TA(N([0, 0])).fill(N(1), 0, 1.5), N([1, 0])), compareArray(new TA([0, 0])).fill(1, 0, 1.5), [1, 0],
'end as a float number coerced' 'end as a float number coerced'
); );
}); });

View File

@ -14,14 +14,14 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(2); var sample = new TA(2);
var n = 1; var n = 1;
sample.fill({ valueOf() { return N(n++); } }); sample.fill({ valueOf() { return n++; } });
assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); assert.sameValue(n, 2, "additional unexpected ToNumber() calls");
assert.sameValue(sample[0], N(1), "incorrect ToNumber result in index 0"); assert.sameValue(sample[0], 1, "incorrect ToNumber result in index 0");
assert.sameValue(sample[1], N(1), "incorrect ToNumber result in index 1"); assert.sameValue(sample[1], 1, "incorrect ToNumber result in index 1");
}); });

View File

@ -33,10 +33,10 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert(compareArray(new TA(N([0, 0, 0])).fill(N(8), 1, 2), N([0, 8, 0]))); assert(compareArray(new TA([0, 0, 0])).fill(8, 1, 2), [0, 8, 0]);
assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -3, 4), N([0, 0, 8, 8, 0]))); assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -3, 4), [0, 0, 8, 8, 0]);
assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -2, -1), N([0, 0, 0, 8, 0]))); assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -2, -1), [0, 0, 0, 8, 0]);
assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -1, -3), N([0, 0, 0, 0, 0]))); assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -1, -3), [0, 0, 0, 0, 0]);
assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), 1, 3), N([0, 8, 8, 0, 0]))); assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, 1, 3), [0, 8, 8, 0, 0]);
}); });

View File

@ -36,41 +36,41 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42])); sample = new TA([42]);
sample.fill(null); sample.fill(null);
assert.sameValue(sample[0], 0, "null => 0"); assert.sameValue(sample[0], 0, "null => 0");
sample = new TA(N([42])); sample = new TA([42]);
sample.fill(false); sample.fill(false);
assert.sameValue(sample[0], N(0), "false => 0"); assert.sameValue(sample[0], 0, "false => 0");
sample = new TA(N([42])); sample = new TA([42]);
sample.fill(true); sample.fill(true);
assert.sameValue(sample[0], N(1), "true => 1"); assert.sameValue(sample[0], 1, "true => 1");
sample = new TA(N([42])); sample = new TA([42]);
sample.fill("7"); sample.fill("7");
assert.sameValue(sample[0], N(7), "string conversion"); assert.sameValue(sample[0], 7, "string conversion");
sample = new TA(N([42])); sample = new TA([42]);
sample.fill({ sample.fill({
toString: function() { toString: function() {
return "1"; return "1";
}, },
valueOf: function() { valueOf: function() {
return N(7); return 7;
} }
}); });
assert.sameValue(sample[0], N(7), "object valueOf conversion before toString"); assert.sameValue(sample[0], 7, "object valueOf conversion before toString");
sample = new TA(N([42])); sample = new TA([42]);
sample.fill({ sample.fill({
toString: function() { toString: function() {
return "7"; return "7";
} }
}); });
assert.sameValue(sample[0], N(7), "object toString when valueOf is absent"); assert.sameValue(sample[0], 7, "object toString when valueOf is absent");
}); });

View File

@ -30,24 +30,24 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, 1), N([8, 0, 0])), compareArray(new TA([0, 0, 0])).fill(8, 0, 1), [8, 0, 0],
"Fill elements from custom end position" "Fill elements from custom end position"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, -1), N([8, 8, 0])), compareArray(new TA([0, 0, 0])).fill(8, 0, -1), [8, 8, 0],
"negative end sets final position to max((length + relativeEnd), 0)" "negative end sets final position to max((length + relativeEnd), 0)"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, 5), N([8, 8, 8])), compareArray(new TA([0, 0, 0])).fill(8, 0, 5), [8, 8, 8],
"end position is never higher than of length" "end position is never higher than of length"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, -4), N([0, 0, 0])), compareArray(new TA([0, 0, 0])).fill(8, 0, -4), [0, 0, 0],
"end position is 0 when (len + relativeEnd) < 0" "end position is 0 when (len + relativeEnd) < 0"
); );
}); });

View File

@ -28,24 +28,24 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), 1), N([0, 8, 8])), compareArray(new TA([0, 0, 0])).fill(8, 1), [0, 8, 8],
"Fill elements from custom start position" "Fill elements from custom start position"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), 4), N([0, 0, 0])), compareArray(new TA([0, 0, 0])).fill(8, 4), [0, 0, 0],
"start position is never higher than length" "start position is never higher than length"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), -1), N([0, 0, 8])), compareArray(new TA([0, 0, 0])).fill(8, -1), [0, 0, 8],
"start < 0 sets initial position to max((len + relativeStart), 0)" "start < 0 sets initial position to max((len + relativeStart), 0)"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8), -5), N([8, 8, 8])), compareArray(new TA([0, 0, 0])).fill(8, -5), [8, 8, 8],
"start position is 0 when (len + relativeStart) < 0" "start position is 0 when (len + relativeStart) < 0"
); );
}); });

View File

@ -28,17 +28,17 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
assert( assert(
compareArray( compareArray(
new TA().fill(N(8)), new TA().fill(8),
[] []
), ),
"does not fill an empty instance" "does not fill an empty instance"
); );
assert( assert(
compareArray(new TA(N([0, 0, 0])).fill(N(8)), N([8, 8, 8])), compareArray(new TA([0, 0, 0])).fill(8), [8, 8, 8],
"Default start and end indexes are 0 and this.length" "Default start and end indexes are 0 and this.length"
); );
}); });

View File

@ -33,7 +33,7 @@ Object.defineProperty(TypedArray.prototype, "length", {
} }
}); });
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
Object.defineProperty(TA.prototype, "length", { Object.defineProperty(TA.prototype, "length", {
get: function() { get: function() {
throw new Test262Error(); throw new Test262Error();
@ -47,5 +47,5 @@ testWithTypedArrayConstructors(function(TA, N) {
} }
}); });
assert.sameValue(sample.fill(N(1), 0), sample); assert.sameValue(sample.fill(1, 0), sample);
}); });

View File

@ -34,9 +34,9 @@ var end = {
} }
}; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(); var sample = new TA();
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
sample.fill(N(1), 0, end); sample.fill(1, 0, end);
}); });
}); });

View File

@ -36,8 +36,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42])); var sample = new TA([42]);
var obj = { var obj = {
valueOf: function() { valueOf: function() {
throw new Test262Error(); throw new Test262Error();

View File

@ -33,9 +33,9 @@ var start = {
} }
}; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(); var sample = new TA();
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
sample.fill(N(1), start); sample.fill(1, start);
}); });
}); });

View File

@ -8,13 +8,13 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample1 = new TA(); var sample1 = new TA();
var result1 = sample1.fill(N(1)); var result1 = sample1.fill(1);
assert.sameValue(result1, sample1); assert.sameValue(result1, sample1);
var sample2 = new TA(42); var sample2 = new TA(42);
var result2 = sample2.fill(N(7)); var result2 = sample2.fill(7);
assert.sameValue(result2, sample2); assert.sameValue(result2, sample2);
}); });

View File

@ -16,8 +16,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
var thisArg = ["test262", 0, "ecma262", 0]; var thisArg = ["test262", 0, "ecma262", 0];
@ -30,17 +30,17 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(thisArg.length, 4, "thisArg.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -16,8 +16,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
@ -28,17 +28,17 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results.length, 3, "results.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -16,8 +16,8 @@ includes: [testTypedArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7, 8])); var sample = new TA([7, 8]);
var results = []; var results = [];
@ -33,6 +33,6 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); assert.sameValue(results[0][0], 7, "results[0][0] - kValue");
assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); assert.sameValue(results[1][0], 8, "results[1][0] - kValue");
}); });

View File

@ -8,16 +8,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample1 = new TA(3); var sample1 = new TA(3);
sample1[1] = N(1); sample1[1] = 1;
sample1.filter(function() { sample1.filter(function() {
return 42; return 42;
}); });
assert.sameValue(sample1[0], N(0), "[0] == 0"); assert.sameValue(sample1[0], 0, "[0] == 0");
assert.sameValue(sample1[1], N(1), "[1] == 1"); assert.sameValue(sample1[1], 1, "[1] == 1");
assert.sameValue(sample1[2], N(0), "[2] == 0"); assert.sameValue(sample1[2], 0, "[2] == 0");
}); });

View File

@ -16,24 +16,24 @@ includes: [testTypedArray.js]
features: [Reflect.set, TypedArray] features: [Reflect.set, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var newVal = 0; var newVal = 0;
sample.filter(function(val, i) { sample.filter(function(val, i) {
if (i > 0) { if (i > 0) {
assert.sameValue( assert.sameValue(
sample[i - 1], N(newVal - 1), sample[i - 1], newVal - 1,
"get the changed value during the loop" "get the changed value during the loop"
); );
assert.sameValue( assert.sameValue(
Reflect.set(sample, 0, N(7)), Reflect.set(sample, 0, 7),
true, true,
"re-set a value for sample[0]" "re-set a value for sample[0]"
); );
} }
assert.sameValue( assert.sameValue(
Reflect.set(sample, i, N(newVal)), Reflect.set(sample, i, newVal),
true, true,
"set value during interaction" "set value during interaction"
); );
@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA, N) {
newVal++; newVal++;
}); });
assert.sameValue(sample[0], N(7), "changed values after interaction [0] == 7"); assert.sameValue(sample[0], 7, "changed values after interaction [0] == 7");
assert.sameValue(sample[1], N(1), "changed values after interaction [1] == 1"); assert.sameValue(sample[1], 1, "changed values after interaction [1] == 1");
assert.sameValue(sample[2], N(2), "changed values after interaction [2] == 2"); assert.sameValue(sample[2], 2, "changed values after interaction [2] == 2");
}); });

View File

@ -15,8 +15,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42])); var sample = new TA([40, 41, 42]);
var result; var result;
result = sample.filter(function() { return true; }); result = sample.filter(function() { return true; });

View File

@ -16,8 +16,8 @@ includes: [testTypedArray.js, compareArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42])); var sample = new TA([40, 41, 42]);
[ [
true, true,

View File

@ -26,8 +26,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42, 43])); var sample = new TA([40, 41, 42, 43]);
Object.defineProperty(sample, "constructor", { Object.defineProperty(sample, "constructor", {
get: function() { get: function() {

View File

@ -26,8 +26,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42, 43])); var sample = new TA([40, 41, 42, 43]);
var calls = 0; var calls = 0;
var result; var result;

View File

@ -30,8 +30,8 @@ features: [Symbol, TypedArray]
var callbackfn = function() { return true; }; var callbackfn = function() { return true; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42, 43])); var sample = new TA([40, 41, 42, 43]);
sample.constructor = 42; sample.constructor = 42;
assert.throws(TypeError, function() { assert.throws(TypeError, function() {

View File

@ -26,8 +26,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42, 43])); var sample = new TA([40, 41, 42, 43]);
var calls = 0; var calls = 0;
var result; var result;

View File

@ -36,8 +36,8 @@ includes: [testTypedArray.js]
features: [Symbol.species, TypedArray] features: [Symbol.species, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 42, 42])); var sample = new TA([40, 42, 42]);
var result, ctorThis; var result, ctorThis;
sample.constructor = {}; sample.constructor = {};
@ -47,7 +47,7 @@ testWithTypedArrayConstructors(function(TA, N) {
return new TA(count); return new TA(count);
}; };
sample.filter(function(v) { return v === N(42); }); sample.filter(function(v) { return v === 42; });
assert.sameValue(result.length, 1, "called with 1 argument"); assert.sameValue(result.length, 1, "called with 1 argument");
assert.sameValue(result[0], 2, "[0] is the new captured length"); assert.sameValue(result[0], 2, "[0] is the new captured length");

View File

@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js]
features: [Symbol.species, TypedArray] features: [Symbol.species, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40])); var sample = new TA([40]);
var otherTA = TA === Int8Array ? Int16Array : Int8Array; var otherTA = TA === Int8Array ? Int16Array : Int8Array;
var other = new otherTA([1, 0, 1]); var other = new otherTA([1, 0, 1]);
var result; var result;

View File

@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js]
features: [Symbol.species, TypedArray] features: [Symbol.species, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([40, 41, 42])); var sample = new TA([40, 41, 42]);
var calls = 0; var calls = 0;
var other, result; var other, result;
@ -52,5 +52,5 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(calls, 1, "ctor called once"); assert.sameValue(calls, 1, "ctor called once");
assert.sameValue(result, other, "return is instance of custom constructor"); assert.sameValue(result, other, "return is instance of custom constructor");
assert(compareArray(result, N([40, 41, 42])), "values are set on the new obj"); assert(compareArray(result, [40, 41, 42]), "values are set on the new obj");
}); });

View File

@ -16,16 +16,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
sample.filter(function(v, i) { sample.filter(function(v, i) {
if (i < sample.length - 1) { if (i < sample.length - 1) {
sample[i+1] = N(42); sample[i+1] = 42;
} }
assert.sameValue( assert.sameValue(
v, N(42), "method does not cache values before callbackfn calls" v, 42, "method does not cache values before callbackfn calls"
); );
}); });
}); });

View File

@ -16,15 +16,15 @@ includes: [testTypedArray.js, compareArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([41, 1, 42, 7])); var sample = new TA([41, 1, 42, 7]);
var result; var result;
result = sample.filter(function() { return true; }); result = sample.filter(function() { return true; });
assert(compareArray(result, N([41, 1, 42, 7])), "values are set #1"); assert(compareArray(result, [41, 1, 42, 7]), "values are set #1");
result = sample.filter(function(v) { result = sample.filter(function(v) {
return v > N(40); return v > 40;
}); });
assert(compareArray(result, N([41, 42])), "values are set #2"); assert(compareArray(result, [41, 42]), "values are set #2");
}); });

View File

@ -31,14 +31,14 @@ Object.defineProperty(TypedArray.prototype, "length", {
} }
}); });
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
Object.defineProperty(TA.prototype, "length", { Object.defineProperty(TA.prototype, "length", {
get: function() { get: function() {
throw new Test262Error(); throw new Test262Error();
} }
}); });
var sample = new TA(N([42])); var sample = new TA([42]);
Object.defineProperty(sample, "length", { Object.defineProperty(sample, "length", {
get: function() { get: function() {
@ -49,6 +49,6 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue( assert.sameValue(
sample.find(function() { return true; }), sample.find(function() { return true; }),
N(42) 42
); );
}); });

View File

@ -29,8 +29,8 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var arr = N([1, 2, 3]); var arr = [1, 2, 3];
var sample; var sample;
var result; var result;
@ -38,41 +38,41 @@ testWithTypedArrayConstructors(function(TA, N) {
sample.find(function(val, i) { sample.find(function(val, i) {
sample[i] = arr[i]; sample[i] = arr[i];
assert.sameValue(val, N(0), "value is not mapped to instance"); assert.sameValue(val, 0, "value is not mapped to instance");
}); });
assert(compareArray(sample, arr), "values set during each predicate call"); assert(compareArray(sample, arr), "values set during each predicate call");
sample = new TA(arr); sample = new TA(arr);
result = sample.find(function(val, i) { result = sample.find(function(val, i) {
if ( i === 0 ) { if ( i === 0 ) {
sample[2] = N(7); sample[2] = 7;
} }
return val === N(7); return val === 7;
}); });
assert.sameValue(result, N(7), "value found"); assert.sameValue(result, 7, "value found");
sample = new TA(arr); sample = new TA(arr);
result = sample.find(function(val, i) { result = sample.find(function(val, i) {
if ( i === 0 ) { if ( i === 0 ) {
sample[2] = N(7); sample[2] = 7;
} }
return val === N(3); return val === 3;
}); });
assert.sameValue(result, undefined, "value not found"); assert.sameValue(result, undefined, "value not found");
sample = new TA(arr); sample = new TA(arr);
result = sample.find(function(val, i) { result = sample.find(function(val, i) {
if ( i > 0 ) { if ( i > 0 ) {
sample[0] = N(7); sample[0] = 7;
} }
return val === N(7); return val === 7;
}); });
assert.sameValue(result, undefined, "value not found - changed after call"); assert.sameValue(result, undefined, "value not found - changed after call");
sample = new TA(arr); sample = new TA(arr);
result = sample.find(function() { result = sample.find(function() {
sample[0] = N(7); sample[0] = 7;
return true; return true;
}); });
assert.sameValue(result, N(1), "find() returns previous found value"); assert.sameValue(result, 1, "find() returns previous found value");
}); });

View File

@ -29,8 +29,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([39, 2, 62])); var sample = new TA([39, 2, 62]);
var results = []; var results = [];
var result; var result;
@ -43,19 +43,19 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results.length, 3, "predicate is called for each index"); assert.sameValue(results.length, 3, "predicate is called for each index");
result = results[0]; result = results[0];
assert.sameValue(result[0], N(39), "results[0][0] === 39, value"); assert.sameValue(result[0], 39, "results[0][0] === 39, value");
assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[1], 0, "results[0][1] === 0, index");
assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance");
assert.sameValue(result.length, 3, "results[0].length === 3 arguments"); assert.sameValue(result.length, 3, "results[0].length === 3 arguments");
result = results[1]; result = results[1];
assert.sameValue(result[0], N(2), "results[1][0] === 2, value"); assert.sameValue(result[0], 2, "results[1][0] === 2, value");
assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[1], 1, "results[1][1] === 1, index");
assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance");
assert.sameValue(result.length, 3, "results[1].length === 3 arguments"); assert.sameValue(result.length, 3, "results[1].length === 3 arguments");
result = results[2]; result = results[2];
assert.sameValue(result[0], N(62), "results[2][0] === 62, value"); assert.sameValue(result[0], 62, "results[2][0] === 62, value");
assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[1], 2, "results[2][1] === 2, index");
assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance");
assert.sameValue(result.length, 3, "results[2].length === 3 arguments"); assert.sameValue(result.length, 3, "results[2].length === 3 arguments");

View File

@ -28,8 +28,8 @@ includes: [testTypedArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([39, 2, 62])); var sample = new TA([39, 2, 62]);
var called, result; var called, result;
called = 0; called = 0;
@ -37,29 +37,29 @@ testWithTypedArrayConstructors(function(TA, N) {
called++; called++;
return true; return true;
}); });
assert.sameValue(result, N(39), "returned true on sample[0]"); assert.sameValue(result, 39, "returned true on sample[0]");
assert.sameValue(called, 1, "predicate was called once"); assert.sameValue(called, 1, "predicate was called once");
called = 0; called = 0;
result = sample.find(function(val) { result = sample.find(function(val) {
called++; called++;
return val === N(62); return val === 62;
}); });
assert.sameValue(called, 3, "predicate was called three times"); assert.sameValue(called, 3, "predicate was called three times");
assert.sameValue(result, N(62), "returned true on sample[3]"); assert.sameValue(result, 62, "returned true on sample[3]");
result = sample.find(function() { return "string"; }); result = sample.find(function() { return "string"; });
assert.sameValue(result, N(39), "ToBoolean(string)"); assert.sameValue(result, 39, "ToBoolean(string)");
result = sample.find(function() { return {}; }); result = sample.find(function() { return {}; });
assert.sameValue(result, N(39), "ToBoolean(object)"); assert.sameValue(result, 39, "ToBoolean(object)");
result = sample.find(function() { return Symbol(""); }); result = sample.find(function() { return Symbol(""); });
assert.sameValue(result, N(39), "ToBoolean(symbol)"); assert.sameValue(result, 39, "ToBoolean(symbol)");
result = sample.find(function() { return 1; }); result = sample.find(function() { return 1; });
assert.sameValue(result, N(39), "ToBoolean(number)"); assert.sameValue(result, 39, "ToBoolean(number)");
result = sample.find(function() { return -1; }); result = sample.find(function() { return -1; });
assert.sameValue(result, N(39), "ToBoolean(negative number)"); assert.sameValue(result, 39, "ToBoolean(negative number)");
}); });

View File

@ -29,14 +29,14 @@ Object.defineProperty(TypedArray.prototype, "length", {
} }
}); });
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
Object.defineProperty(TA.prototype, "length", { Object.defineProperty(TA.prototype, "length", {
get: function() { get: function() {
throw new Test262Error(); throw new Test262Error();
} }
}); });
var sample = new TA(N([42])); var sample = new TA([42]);
Object.defineProperty(sample, "length", { Object.defineProperty(sample, "length", {
get: function() { get: function() {

View File

@ -25,8 +25,8 @@ includes: [compareArray.js, testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var arr = N([10, 20, 30]); var arr = [10, 20, 30];
var sample; var sample;
var result; var result;
@ -34,34 +34,34 @@ testWithTypedArrayConstructors(function(TA, N) {
sample.findIndex(function(val, i) { sample.findIndex(function(val, i) {
sample[i] = arr[i]; sample[i] = arr[i];
assert.sameValue(val, N(0), "value is not mapped to instance"); assert.sameValue(val, 0, "value is not mapped to instance");
}); });
assert(compareArray(sample, arr), "values set during each predicate call"); assert(compareArray(sample, arr), "values set during each predicate call");
sample = new TA(arr); sample = new TA(arr);
result = sample.findIndex(function(val, i) { result = sample.findIndex(function(val, i) {
if ( i === 0 ) { if ( i === 0 ) {
sample[2] = N(7); sample[2] = 7;
} }
return val === N(7); return val === 7;
}); });
assert.sameValue(result, 2, "value found"); assert.sameValue(result, 2, "value found");
sample = new TA(arr); sample = new TA(arr);
result = sample.findIndex(function(val, i) { result = sample.findIndex(function(val, i) {
if ( i === 0 ) { if ( i === 0 ) {
sample[2] = N(7); sample[2] = 7;
} }
return val === N(30); return val === 30;
}); });
assert.sameValue(result, -1, "value not found"); assert.sameValue(result, -1, "value not found");
sample = new TA(arr); sample = new TA(arr);
result = sample.findIndex(function(val, i) { result = sample.findIndex(function(val, i) {
if ( i > 0 ) { if ( i > 0 ) {
sample[0] = N(7); sample[0] = 7;
} }
return val === N(7); return val === 7;
}); });
assert.sameValue(result, -1, "value not found - changed after call"); assert.sameValue(result, -1, "value not found - changed after call");
}); });

View File

@ -27,8 +27,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([39, 2, 62])); var sample = new TA([39, 2, 62]);
var results = []; var results = [];
var result; var result;
@ -41,19 +41,19 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results.length, 3, "predicate is called for each index"); assert.sameValue(results.length, 3, "predicate is called for each index");
result = results[0]; result = results[0];
assert.sameValue(result[0], N(39), "results[0][0] === 39, value"); assert.sameValue(result[0], 39, "results[0][0] === 39, value");
assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[1], 0, "results[0][1] === 0, index");
assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance");
assert.sameValue(result.length, 3, "results[0].length === 3, arguments"); assert.sameValue(result.length, 3, "results[0].length === 3, arguments");
result = results[1]; result = results[1];
assert.sameValue(result[0], N(2), "results[1][0] === 2, value"); assert.sameValue(result[0], 2, "results[1][0] === 2, value");
assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[1], 1, "results[1][1] === 1, index");
assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance");
assert.sameValue(result.length, 3, "results[1].length === 3, arguments"); assert.sameValue(result.length, 3, "results[1].length === 3, arguments");
result = results[2]; result = results[2];
assert.sameValue(result[0], N(62), "results[2][0] === 62, value"); assert.sameValue(result[0], 62, "results[2][0] === 62, value");
assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[1], 2, "results[2][1] === 2, index");
assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance");
assert.sameValue(result.length, 3, "results[2].length === 3, arguments"); assert.sameValue(result.length, 3, "results[2].length === 3, arguments");

View File

@ -27,8 +27,8 @@ includes: [testTypedArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([39, 3, 9])); var sample = new TA([39, 3, 9]);
var called = 0; var called = 0;
var result = sample.findIndex(function() { var result = sample.findIndex(function() {
@ -42,7 +42,7 @@ testWithTypedArrayConstructors(function(TA, N) {
called = 0; called = 0;
result = sample.findIndex(function(val) { result = sample.findIndex(function(val) {
called++; called++;
return val === N(9); return val === 9;
}); });
assert.sameValue(called, 3, "predicate was called three times"); assert.sameValue(called, 3, "predicate was called three times");

View File

@ -26,8 +26,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([1, 2, 3])); var sample = new TA([1, 2, 3]);
var called = 0; var called = 0;
var result = sample.findIndex(function() { var result = sample.findIndex(function() {

View File

@ -25,8 +25,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
var thisArg = ["test262", 0, "ecma262", 0]; var thisArg = ["test262", 0, "ecma262", 0];
@ -39,17 +39,17 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(thisArg.length, 4, "thisArg.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -25,8 +25,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
@ -37,17 +37,17 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results.length, 3, "results.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -19,8 +19,8 @@ includes: [testTypedArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7, 8])); var sample = new TA([7, 8]);
var results = []; var results = [];
@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); assert.sameValue(results[0][0], 7, "results[0][0] - kValue");
assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); assert.sameValue(results[1][0], 8, "results[1][0] - kValue");
}); });

View File

@ -15,16 +15,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample1 = new TA(3); var sample1 = new TA(3);
sample1[1] = N(1); sample1[1] = 1;
sample1.forEach(function() { sample1.forEach(function() {
return 42; return 42;
}); });
assert.sameValue(sample1[0], N(0), "[0] == 0"); assert.sameValue(sample1[0], 0, "[0] == 0");
assert.sameValue(sample1[1], N(1), "[1] == 1"); assert.sameValue(sample1[1], 1, "[1] == 1");
assert.sameValue(sample1[2], N(0), "[2] == 0"); assert.sameValue(sample1[2], 0, "[2] == 0");
}); });

View File

@ -16,24 +16,24 @@ includes: [testTypedArray.js]
features: [Reflect.set, TypedArray] features: [Reflect.set, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var newVal = 0; var newVal = 0;
sample.forEach(function(val, i) { sample.forEach(function(val, i) {
if (i > 0) { if (i > 0) {
assert.sameValue( assert.sameValue(
sample[i - 1], N(newVal - 1), sample[i - 1], newVal - 1,
"get the changed value during the loop" "get the changed value during the loop"
); );
assert.sameValue( assert.sameValue(
Reflect.set(sample, 0, N(7)), Reflect.set(sample, 0, 7),
true, true,
"re-set a value for sample[0]" "re-set a value for sample[0]"
); );
} }
assert.sameValue( assert.sameValue(
Reflect.set(sample, i, N(newVal)), Reflect.set(sample, i, newVal),
true, true,
"set value during iteration" "set value during iteration"
); );
@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA, N) {
newVal++; newVal++;
}); });
assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7");
assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1");
assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2");
}); });

View File

@ -16,16 +16,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
sample.forEach(function(v, i) { sample.forEach(function(v, i) {
if (i < sample.length - 1) { if (i < sample.length - 1) {
sample[i+1] = N(42); sample[i+1] = 42;
} }
assert.sameValue( assert.sameValue(
v, N(42), "method does not cache values before callbackfn calls" v, 42, "method does not cache values before callbackfn calls"
); );
}); });
}); });

View File

@ -29,16 +29,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 43, 41])); var sample = new TA([42, 43, 43, 41]);
assert.sameValue( assert.sameValue(
sample.includes(N(43), Infinity), sample.includes(43, Infinity),
false, false,
"includes(43, Infinity)" "includes(43, Infinity)"
); );
assert.sameValue( assert.sameValue(
sample.includes(N(43), -Infinity), sample.includes(43, -Infinity),
true, true,
"includes(43, -Infinity)"); "includes(43, -Infinity)");
}); });

View File

@ -24,11 +24,11 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43])); sample = new TA([42, 43]);
assert.sameValue(sample.includes(N(42), -0), true, "-0 [0]"); assert.sameValue(sample.includes(42, -0), true, "-0 [0]");
assert.sameValue(sample.includes(N(43), -0), true, "-0 [1]"); assert.sameValue(sample.includes(43, -0), true, "-0 [1]");
assert.sameValue(sample.includes(N(44), -0), false, "-0 [2]"); assert.sameValue(sample.includes(44, -0), false, "-0 [2]");
}); });

View File

@ -23,11 +23,11 @@ features: [TypedArray]
Object.defineProperty(TypedArray.prototype, "length", {value: 0}); Object.defineProperty(TypedArray.prototype, "length", {value: 0});
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7])); var sample = new TA([7]);
Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(TA.prototype, "length", {value: 0});
Object.defineProperty(sample, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0});
assert.sameValue(sample.includes(N(7)), true); assert.sameValue(sample.includes(7), true);
}); });

View File

@ -24,10 +24,10 @@ features: [Symbol, TypedArray]
var fromIndex = Symbol("1"); var fromIndex = Symbol("1");
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7])); var sample = new TA([7]);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
sample.includes(N(7), fromIndex); sample.includes(7, fromIndex);
}); });
}); });

View File

@ -28,10 +28,10 @@ var fromIndex = {
} }
}; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7])); var sample = new TA([7]);
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
sample.includes(N(7), fromIndex); sample.includes(7, fromIndex);
}); });
}); });

View File

@ -29,16 +29,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 42, 41])); var sample = new TA([42, 43, 42, 41]);
assert.sameValue(sample.includes(N(42)), true, "includes(42)"); assert.sameValue(sample.includes(42), true, "includes(42)");
assert.sameValue(sample.includes(N(43)), true, "includes(43)"); assert.sameValue(sample.includes(43), true, "includes(43)");
assert.sameValue(sample.includes(N(43), 1), true, "includes(43, 1)"); assert.sameValue(sample.includes(43, 1), true, "includes(43, 1)");
assert.sameValue(sample.includes(N(42), 1), true, "includes(42, 1)"); assert.sameValue(sample.includes(42, 1), true, "includes(42, 1)");
assert.sameValue(sample.includes(N(42), 2), true, "includes(42, 2)"); assert.sameValue(sample.includes(42, 2), true, "includes(42, 2)");
assert.sameValue(sample.includes(N(42), -4), true, "includes(42, -4)"); assert.sameValue(sample.includes(42, -4), true, "includes(42, -4)");
assert.sameValue(sample.includes(N(42), -3), true, "includes(42, -3)"); assert.sameValue(sample.includes(42, -3), true, "includes(42, -3)");
assert.sameValue(sample.includes(N(42), -2), true, "includes(42, -2)"); assert.sameValue(sample.includes(42, -2), true, "includes(42, -2)");
assert.sameValue(sample.includes(N(42), -5), true, "includes(42, -5)"); assert.sameValue(sample.includes(42, -5), true, "includes(42, -5)");
}); });

View File

@ -29,14 +29,14 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43, 42, 41])); sample = new TA([42, 43, 42, 41]);
assert.sameValue(sample.includes(N(44)), false, "includes(44)"); assert.sameValue(sample.includes(44), false, "includes(44)");
assert.sameValue(sample.includes(N(43), 2), false, "includes(43, 2)"); assert.sameValue(sample.includes(43, 2), false, "includes(43, 2)");
assert.sameValue(sample.includes(N(42), 3), false, "includes(42, 3)"); assert.sameValue(sample.includes(42, 3), false, "includes(42, 3)");
assert.sameValue(sample.includes(N(44), -4), false, "includes(44, -4)"); assert.sameValue(sample.includes(44, -4), false, "includes(44, -4)");
assert.sameValue(sample.includes(N(44), -5), false, "includes(44, -5)"); assert.sameValue(sample.includes(44, -5), false, "includes(44, -5)");
assert.sameValue(sample.includes(N(42), -1), false, "includes(42, -1)"); assert.sameValue(sample.includes(42, -1), false, "includes(42, -1)");
}); });

View File

@ -35,31 +35,31 @@ var obj = {
} }
}; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43])); sample = new TA([42, 43]);
assert.sameValue(sample.includes(N(42), "1"), false, "string [0]"); assert.sameValue(sample.includes(42, "1"), false, "string [0]");
assert.sameValue(sample.includes(N(43), "1"), true, "string [1]"); assert.sameValue(sample.includes(43, "1"), true, "string [1]");
assert.sameValue(sample.includes(N(42), true), false, "true [0]"); assert.sameValue(sample.includes(42, true), false, "true [0]");
assert.sameValue(sample.includes(N(43), true), true, "true [1]"); assert.sameValue(sample.includes(43, true), true, "true [1]");
assert.sameValue(sample.includes(N(42), false), true, "false [0]"); assert.sameValue(sample.includes(42, false), true, "false [0]");
assert.sameValue(sample.includes(N(43), false), true, "false [1]"); assert.sameValue(sample.includes(43, false), true, "false [1]");
assert.sameValue(sample.includes(N(42), NaN), true, "NaN [0]"); assert.sameValue(sample.includes(42, NaN), true, "NaN [0]");
assert.sameValue(sample.includes(N(43), NaN), true, "NaN [1]"); assert.sameValue(sample.includes(43, NaN), true, "NaN [1]");
assert.sameValue(sample.includes(N(42), null), true, "null [0]"); assert.sameValue(sample.includes(42, null), true, "null [0]");
assert.sameValue(sample.includes(N(43), null), true, "null [1]"); assert.sameValue(sample.includes(43, null), true, "null [1]");
assert.sameValue(sample.includes(N(42), undefined), true, "undefined [0]"); assert.sameValue(sample.includes(42, undefined), true, "undefined [0]");
assert.sameValue(sample.includes(N(43), undefined), true, "undefined [1]"); assert.sameValue(sample.includes(43, undefined), true, "undefined [1]");
assert.sameValue(sample.includes(N(42), null), true, "null [0]"); assert.sameValue(sample.includes(42, null), true, "null [0]");
assert.sameValue(sample.includes(N(43), null), true, "null [1]"); assert.sameValue(sample.includes(43, null), true, "null [1]");
assert.sameValue(sample.includes(N(42), obj), false, "object [0]"); assert.sameValue(sample.includes(42, obj), false, "object [0]");
assert.sameValue(sample.includes(N(43), obj), true, "object [1]"); assert.sameValue(sample.includes(43, obj), true, "object [1]");
}); });

View File

@ -31,9 +31,9 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 43, 41])); var sample = new TA([42, 43, 43, 41]);
assert.sameValue(sample.indexOf(N(43), Infinity), -1, "indexOf(43, Infinity)"); assert.sameValue(sample.indexOf(43, Infinity), -1, "indexOf(43, Infinity)");
assert.sameValue(sample.indexOf(N(43), -Infinity), 1, "indexOf(43, -Infinity)"); assert.sameValue(sample.indexOf(43, -Infinity), 1, "indexOf(43, -Infinity)");
}); });

View File

@ -21,10 +21,10 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43])); sample = new TA([42, 43]);
assert.sameValue(sample.indexOf(N(42), -0), 0, "-0 [0]"); assert.sameValue(sample.indexOf(42, -0), 0, "-0 [0]");
assert.sameValue(sample.indexOf(N(43), -0), 1, "-0 [1]"); assert.sameValue(sample.indexOf(43, -0), 1, "-0 [1]");
}); });

View File

@ -22,11 +22,11 @@ features: [TypedArray]
Object.defineProperty(TypedArray.prototype, "length", {value: 0}); Object.defineProperty(TypedArray.prototype, "length", {value: 0});
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7])); var sample = new TA([7]);
Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(TA.prototype, "length", {value: 0});
Object.defineProperty(sample, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0});
assert.sameValue(sample.indexOf(N(7)), 0); assert.sameValue(sample.indexOf(7), 0);
}); });

View File

@ -31,16 +31,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 42, 41])); var sample = new TA([42, 43, 42, 41]);
assert.sameValue(sample.indexOf(N(42)), 0, "indexOf(42)"); assert.sameValue(sample.indexOf(42), 0, "indexOf(42)");
assert.sameValue(sample.indexOf(N(43)), 1, "indexOf(43)"); assert.sameValue(sample.indexOf(43), 1, "indexOf(43)");
assert.sameValue(sample.indexOf(N(43), 1), 1, "indexOf(43, 1)"); assert.sameValue(sample.indexOf(43, 1), 1, "indexOf(43, 1)");
assert.sameValue(sample.indexOf(N(42), 1), 2, "indexOf(42, 1)"); assert.sameValue(sample.indexOf(42, 1), 2, "indexOf(42, 1)");
assert.sameValue(sample.indexOf(N(42), 2), 2, "indexOf(42, 2)"); assert.sameValue(sample.indexOf(42, 2), 2, "indexOf(42, 2)");
assert.sameValue(sample.indexOf(N(42), -4), 0, "indexOf(42, -4)"); assert.sameValue(sample.indexOf(42, -4), 0, "indexOf(42, -4)");
assert.sameValue(sample.indexOf(N(42), -3), 2, "indexOf(42, -3)"); assert.sameValue(sample.indexOf(42, -3), 2, "indexOf(42, -3)");
assert.sameValue(sample.indexOf(N(42), -2), 2, "indexOf(42, -2)"); assert.sameValue(sample.indexOf(42, -2), 2, "indexOf(42, -2)");
assert.sameValue(sample.indexOf(N(42), -5), 0, "indexOf(42, -5)"); assert.sameValue(sample.indexOf(42, -5), 0, "indexOf(42, -5)");
}); });

View File

@ -25,14 +25,14 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43, 42, 41])); sample = new TA([42, 43, 42, 41]);
assert.sameValue(sample.indexOf(N(44)), -1, "indexOf(44)"); assert.sameValue(sample.indexOf(44), -1, "indexOf(44)");
assert.sameValue(sample.indexOf(N(43), 2), -1, "indexOf(43, 2)"); assert.sameValue(sample.indexOf(43, 2), -1, "indexOf(43, 2)");
assert.sameValue(sample.indexOf(N(42), 3), -1, "indexOf(42, 3)"); assert.sameValue(sample.indexOf(42, 3), -1, "indexOf(42, 3)");
assert.sameValue(sample.indexOf(N(44), -4), -1, "indexOf(44, -4)"); assert.sameValue(sample.indexOf(44, -4), -1, "indexOf(44, -4)");
assert.sameValue(sample.indexOf(N(44), -5), -1, "indexOf(44, -5)"); assert.sameValue(sample.indexOf(44, -5), -1, "indexOf(44, -5)");
assert.sameValue(sample.indexOf(N(42), -1), -1, "indexOf(42, -1)"); assert.sameValue(sample.indexOf(42, -1), -1, "indexOf(42, -1)");
}); });

View File

@ -27,31 +27,31 @@ var obj = {
} }
}; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43])); sample = new TA([42, 43]);
assert.sameValue(sample.indexOf(N(42), "1"), -1, "string [0]"); assert.sameValue(sample.indexOf(42, "1"), -1, "string [0]");
assert.sameValue(sample.indexOf(N(43), "1"), 1, "string [1]"); assert.sameValue(sample.indexOf(43, "1"), 1, "string [1]");
assert.sameValue(sample.indexOf(N(42), true), -1, "true [0]"); assert.sameValue(sample.indexOf(42, true), -1, "true [0]");
assert.sameValue(sample.indexOf(N(43), true), 1, "true [1]"); assert.sameValue(sample.indexOf(43, true), 1, "true [1]");
assert.sameValue(sample.indexOf(N(42), false), 0, "false [0]"); assert.sameValue(sample.indexOf(42, false), 0, "false [0]");
assert.sameValue(sample.indexOf(N(43), false), 1, "false [1]"); assert.sameValue(sample.indexOf(43, false), 1, "false [1]");
assert.sameValue(sample.indexOf(N(42), NaN), 0, "NaN [0]"); assert.sameValue(sample.indexOf(42, NaN), 0, "NaN [0]");
assert.sameValue(sample.indexOf(N(43), NaN), 1, "NaN [1]"); assert.sameValue(sample.indexOf(43, NaN), 1, "NaN [1]");
assert.sameValue(sample.indexOf(N(42), null), 0, "null [0]"); assert.sameValue(sample.indexOf(42, null), 0, "null [0]");
assert.sameValue(sample.indexOf(N(43), null), 1, "null [1]"); assert.sameValue(sample.indexOf(43, null), 1, "null [1]");
assert.sameValue(sample.indexOf(N(42), undefined), 0, "undefined [0]"); assert.sameValue(sample.indexOf(42, undefined), 0, "undefined [0]");
assert.sameValue(sample.indexOf(N(43), undefined), 1, "undefined [1]"); assert.sameValue(sample.indexOf(43, undefined), 1, "undefined [1]");
assert.sameValue(sample.indexOf(N(42), null), 0, "null [0]"); assert.sameValue(sample.indexOf(42, null), 0, "null [0]");
assert.sameValue(sample.indexOf(N(43), null), 1, "null [1]"); assert.sameValue(sample.indexOf(43, null), 1, "null [1]");
assert.sameValue(sample.indexOf(N(42), obj), -1, "object [0]"); assert.sameValue(sample.indexOf(42, obj), -1, "object [0]");
assert.sameValue(sample.indexOf(N(43), obj), 1, "object [1]"); assert.sameValue(sample.indexOf(43, obj), 1, "object [1]");
}); });

View File

@ -29,8 +29,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([1, 0, 2, 3, 42, 127])); var sample = new TA([1, 0, 2, 3, 42, 127]);
var result; var result;

View File

@ -32,8 +32,8 @@ var desc = {
Object.defineProperty(TypedArray.prototype, "length", desc); Object.defineProperty(TypedArray.prototype, "length", desc);
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43])); var sample = new TA([42, 43]);
Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(TA.prototype, "length", desc);
Object.defineProperty(sample, "length", desc); Object.defineProperty(sample, "length", desc);

View File

@ -28,8 +28,8 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([1, 0, 2, 3, 42, 127])); var sample = new TA([1, 0, 2, 3, 42, 127]);
var result = sample.join(); var result = sample.join();

View File

@ -17,8 +17,8 @@ features: [Symbol.iterator, TypedArray]
var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([0, 42, 64])); var sample = new TA([0, 42, 64]);
var iter = sample.keys(); var iter = sample.keys();
assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto);

View File

@ -15,8 +15,8 @@ features: [TypedArray]
var sample = [0, 42, 64]; var sample = [0, 42, 64];
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var typedArray = new TA(N(sample)); var typedArray = new TA(sample);
var itor = typedArray.keys(); var itor = typedArray.keys();
var next = itor.next(); var next = itor.next();

View File

@ -24,9 +24,9 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 43, 41])); var sample = new TA([42, 43, 43, 41]);
assert.sameValue(sample.lastIndexOf(N(43), Infinity), 2, "lastIndexOf(43, Infinity)"); assert.sameValue(sample.lastIndexOf(43, Infinity), 2, "lastIndexOf(43, Infinity)");
assert.sameValue(sample.lastIndexOf(N(43), -Infinity), -1, "lastIndexOf(43, -Infinity)"); assert.sameValue(sample.lastIndexOf(43, -Infinity), -1, "lastIndexOf(43, -Infinity)");
}); });

View File

@ -21,10 +21,10 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43])); sample = new TA([42, 43]);
assert.sameValue(sample.lastIndexOf(N(42), -0), 0, "-0 [0]"); assert.sameValue(sample.lastIndexOf(42, -0), 0, "-0 [0]");
assert.sameValue(sample.lastIndexOf(N(43), -0), -1, "-0 [1]"); assert.sameValue(sample.lastIndexOf(43, -0), -1, "-0 [1]");
}); });

View File

@ -22,11 +22,11 @@ features: [TypedArray]
Object.defineProperty(TypedArray.prototype, "length", {value: 0}); Object.defineProperty(TypedArray.prototype, "length", {value: 0});
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7])); var sample = new TA([7]);
Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(TA.prototype, "length", {value: 0});
Object.defineProperty(sample, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0});
assert.sameValue(sample.lastIndexOf(N(7)), 0); assert.sameValue(sample.lastIndexOf(7), 0);
}); });

View File

@ -30,28 +30,28 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 42, 41])); var sample = new TA([42, 43, 42, 41]);
assert.sameValue(sample.lastIndexOf(N(42)), 2, "lastIndexOf(42)"); assert.sameValue(sample.lastIndexOf(42), 2, "lastIndexOf(42)");
assert.sameValue(sample.lastIndexOf(N(43)), 1, "lastIndexOf(43)"); assert.sameValue(sample.lastIndexOf(43), 1, "lastIndexOf(43)");
assert.sameValue(sample.lastIndexOf(N(41)), 3, "lastIndexOf(41)"); assert.sameValue(sample.lastIndexOf(41), 3, "lastIndexOf(41)");
assert.sameValue(sample.lastIndexOf(N(41), 3), 3, "lastIndexOf(41, 3)"); assert.sameValue(sample.lastIndexOf(41, 3), 3, "lastIndexOf(41, 3)");
assert.sameValue(sample.lastIndexOf(N(41), 4), 3, "lastIndexOf(41, 4)"); assert.sameValue(sample.lastIndexOf(41, 4), 3, "lastIndexOf(41, 4)");
assert.sameValue(sample.lastIndexOf(N(43), 1), 1, "lastIndexOf(43, 1)"); assert.sameValue(sample.lastIndexOf(43, 1), 1, "lastIndexOf(43, 1)");
assert.sameValue(sample.lastIndexOf(N(43), 2), 1, "lastIndexOf(43, 2)"); assert.sameValue(sample.lastIndexOf(43, 2), 1, "lastIndexOf(43, 2)");
assert.sameValue(sample.lastIndexOf(N(43), 3), 1, "lastIndexOf(43, 3)"); assert.sameValue(sample.lastIndexOf(43, 3), 1, "lastIndexOf(43, 3)");
assert.sameValue(sample.lastIndexOf(N(43), 4), 1, "lastIndexOf(43, 4)"); assert.sameValue(sample.lastIndexOf(43, 4), 1, "lastIndexOf(43, 4)");
assert.sameValue(sample.lastIndexOf(N(42), 0), 0, "lastIndexOf(42, 0)"); assert.sameValue(sample.lastIndexOf(42, 0), 0, "lastIndexOf(42, 0)");
assert.sameValue(sample.lastIndexOf(N(42), 1), 0, "lastIndexOf(42, 1)"); assert.sameValue(sample.lastIndexOf(42, 1), 0, "lastIndexOf(42, 1)");
assert.sameValue(sample.lastIndexOf(N(42), 2), 2, "lastIndexOf(42, 2)"); assert.sameValue(sample.lastIndexOf(42, 2), 2, "lastIndexOf(42, 2)");
assert.sameValue(sample.lastIndexOf(N(42), 3), 2, "lastIndexOf(42, 3)"); assert.sameValue(sample.lastIndexOf(42, 3), 2, "lastIndexOf(42, 3)");
assert.sameValue(sample.lastIndexOf(N(42), 4), 2, "lastIndexOf(42, 4)"); assert.sameValue(sample.lastIndexOf(42, 4), 2, "lastIndexOf(42, 4)");
assert.sameValue(sample.lastIndexOf(N(42), -4), 0, "lastIndexOf(42, -4)"); assert.sameValue(sample.lastIndexOf(42, -4), 0, "lastIndexOf(42, -4)");
assert.sameValue(sample.lastIndexOf(N(42), -3), 0, "lastIndexOf(42, -3)"); assert.sameValue(sample.lastIndexOf(42, -3), 0, "lastIndexOf(42, -3)");
assert.sameValue(sample.lastIndexOf(N(42), -2), 2, "lastIndexOf(42, -2)"); assert.sameValue(sample.lastIndexOf(42, -2), 2, "lastIndexOf(42, -2)");
assert.sameValue(sample.lastIndexOf(N(42), -1), 2, "lastIndexOf(42, -1)"); assert.sameValue(sample.lastIndexOf(42, -1), 2, "lastIndexOf(42, -1)");
assert.sameValue(sample.lastIndexOf(N(43), -3), 1, "lastIndexOf(43, -3)"); assert.sameValue(sample.lastIndexOf(43, -3), 1, "lastIndexOf(43, -3)");
assert.sameValue(sample.lastIndexOf(N(43), -2), 1, "lastIndexOf(43, -2)"); assert.sameValue(sample.lastIndexOf(43, -2), 1, "lastIndexOf(43, -2)");
assert.sameValue(sample.lastIndexOf(N(43), -1), 1, "lastIndexOf(43, -1)"); assert.sameValue(sample.lastIndexOf(43, -1), 1, "lastIndexOf(43, -1)");
assert.sameValue(sample.lastIndexOf(N(41), -1), 3, "lastIndexOf(41, -1)"); assert.sameValue(sample.lastIndexOf(41, -1), 3, "lastIndexOf(41, -1)");
}); });

View File

@ -25,18 +25,18 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43, 42, 41])); sample = new TA([42, 43, 42, 41]);
assert.sameValue(sample.lastIndexOf(N(44)), -1, "lastIndexOf(44)"); assert.sameValue(sample.lastIndexOf(44), -1, "lastIndexOf(44)");
assert.sameValue(sample.lastIndexOf(N(44), -4), -1, "lastIndexOf(44, -4)"); assert.sameValue(sample.lastIndexOf(44, -4), -1, "lastIndexOf(44, -4)");
assert.sameValue(sample.lastIndexOf(N(44), -5), -1, "lastIndexOf(44, -5)"); assert.sameValue(sample.lastIndexOf(44, -5), -1, "lastIndexOf(44, -5)");
assert.sameValue(sample.lastIndexOf(N(42), -5), -1, "lastIndexOf(42, -5)"); assert.sameValue(sample.lastIndexOf(42, -5), -1, "lastIndexOf(42, -5)");
assert.sameValue(sample.lastIndexOf(N(43), -4), -1, "lastIndexOf(43, -4)"); assert.sameValue(sample.lastIndexOf(43, -4), -1, "lastIndexOf(43, -4)");
assert.sameValue(sample.lastIndexOf(N(43), -5), -1, "lastIndexOf(43, -5)"); assert.sameValue(sample.lastIndexOf(43, -5), -1, "lastIndexOf(43, -5)");
assert.sameValue(sample.lastIndexOf(N(41), 0), -1, "lastIndexOf(41, 0)"); assert.sameValue(sample.lastIndexOf(41, 0), -1, "lastIndexOf(41, 0)");
assert.sameValue(sample.lastIndexOf(N(41), 1), -1, "lastIndexOf(41, 1)"); assert.sameValue(sample.lastIndexOf(41, 1), -1, "lastIndexOf(41, 1)");
assert.sameValue(sample.lastIndexOf(N(41), 2), -1, "lastIndexOf(41, 2)"); assert.sameValue(sample.lastIndexOf(41, 2), -1, "lastIndexOf(41, 2)");
assert.sameValue(sample.lastIndexOf(N(43), 0), -1, "lastIndexOf(43, 0)"); assert.sameValue(sample.lastIndexOf(43, 0), -1, "lastIndexOf(43, 0)");
}); });

View File

@ -27,31 +27,31 @@ var obj = {
} }
}; };
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample; var sample;
sample = new TA(N([42, 43])); sample = new TA([42, 43]);
assert.sameValue(sample.lastIndexOf(N(42), "1"), 0, "string [0]"); assert.sameValue(sample.lastIndexOf(42, "1"), 0, "string [0]");
assert.sameValue(sample.lastIndexOf(N(43), "1"), 1, "string [1]"); assert.sameValue(sample.lastIndexOf(43, "1"), 1, "string [1]");
assert.sameValue(sample.lastIndexOf(N(42), true), 0, "true [0]"); assert.sameValue(sample.lastIndexOf(42, true), 0, "true [0]");
assert.sameValue(sample.lastIndexOf(N(43), true), 1, "true [1]"); assert.sameValue(sample.lastIndexOf(43, true), 1, "true [1]");
assert.sameValue(sample.lastIndexOf(N(42), false), 0, "false [0]"); assert.sameValue(sample.lastIndexOf(42, false), 0, "false [0]");
assert.sameValue(sample.lastIndexOf(N(43), false), -1, "false [1]"); assert.sameValue(sample.lastIndexOf(43, false), -1, "false [1]");
assert.sameValue(sample.lastIndexOf(N(42), NaN), 0, "NaN [0]"); assert.sameValue(sample.lastIndexOf(42, NaN), 0, "NaN [0]");
assert.sameValue(sample.lastIndexOf(N(43), NaN), -1, "NaN [1]"); assert.sameValue(sample.lastIndexOf(43, NaN), -1, "NaN [1]");
assert.sameValue(sample.lastIndexOf(N(42), null), 0, "null [0]"); assert.sameValue(sample.lastIndexOf(42, null), 0, "null [0]");
assert.sameValue(sample.lastIndexOf(N(43), null), -1, "null [1]"); assert.sameValue(sample.lastIndexOf(43, null), -1, "null [1]");
assert.sameValue(sample.lastIndexOf(N(42), undefined), 0, "undefined [0]"); assert.sameValue(sample.lastIndexOf(42, undefined), 0, "undefined [0]");
assert.sameValue(sample.lastIndexOf(N(43), undefined), -1, "undefined [1]"); assert.sameValue(sample.lastIndexOf(43, undefined), -1, "undefined [1]");
assert.sameValue(sample.lastIndexOf(N(42), null), 0, "null [0]"); assert.sameValue(sample.lastIndexOf(42, null), 0, "null [0]");
assert.sameValue(sample.lastIndexOf(N(43), null), -1, "null [1]"); assert.sameValue(sample.lastIndexOf(43, null), -1, "null [1]");
assert.sameValue(sample.lastIndexOf(N(42), obj), 0, "object [0]"); assert.sameValue(sample.lastIndexOf(42, obj), 0, "object [0]");
assert.sameValue(sample.lastIndexOf(N(43), obj), 1, "object [1]"); assert.sameValue(sample.lastIndexOf(43, obj), 1, "object [1]");
}); });

View File

@ -14,7 +14,7 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample1 = new TA(42); var sample1 = new TA(42);
var loop = 0; var loop = 0;
@ -22,7 +22,7 @@ testWithTypedArrayConstructors(function(TA, N) {
sample1.map(function() { sample1.map(function() {
loop++; loop++;
return N(0); return 0;
}); });
assert.sameValue(loop, 42, "data descriptor"); assert.sameValue(loop, 42, "data descriptor");
@ -38,7 +38,7 @@ testWithTypedArrayConstructors(function(TA, N) {
sample2.map(function() { sample2.map(function() {
loop++; loop++;
return N(0); return 0;
}); });
assert.sameValue(loop, 4, "accessor descriptor"); assert.sameValue(loop, 4, "accessor descriptor");
}); });

View File

@ -17,32 +17,32 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
var thisArg = ["test262", 0, "ecma262", 0]; var thisArg = ["test262", 0, "ecma262", 0];
sample.map(function() { sample.map(function() {
results.push(arguments); results.push(arguments);
return N(0); return 0;
}, thisArg); }, thisArg);
assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results.length, 3, "results.length");
assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(thisArg.length, 4, "thisArg.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -17,30 +17,30 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([42, 43, 44])); var sample = new TA([42, 43, 44]);
var results = []; var results = [];
sample.map(function() { sample.map(function() {
results.push(arguments); results.push(arguments);
return N(0); return 0;
}); });
assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results.length, 3, "results.length");
assert.sameValue(results[0].length, 3, "results[0].length"); assert.sameValue(results[0].length, 3, "results[0].length");
assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][0], 42, "results[0][0] - kValue");
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[0][2], sample, "results[0][2] - this");
assert.sameValue(results[1].length, 3, "results[1].length"); assert.sameValue(results[1].length, 3, "results[1].length");
assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][0], 43, "results[1][0] - kValue");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[1][2], sample, "results[1][2] - this");
assert.sameValue(results[2].length, 3, "results[2].length"); assert.sameValue(results[2].length, 3, "results[2].length");
assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][0], 44, "results[2][0] - kValue");
assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][1], 2, "results[2][1] - k");
assert.sameValue(results[2][2], sample, "results[2][2] - this"); assert.sameValue(results[2][2], sample, "results[2][2] - this");
}); });

View File

@ -28,7 +28,7 @@ testWithTypedArrayConstructors(function(TA) {
} }
$DETACHBUFFER(sample.buffer); $DETACHBUFFER(sample.buffer);
loops++; loops++;
return N(0); return 0;
}); });
}); });

View File

@ -18,8 +18,8 @@ includes: [testTypedArray.js, compareArray.js]
features: [Symbol, TypedArray] features: [Symbol, TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([7, 8])); var sample = new TA([7, 8]);
var results = []; var results = [];
@ -28,7 +28,7 @@ testWithTypedArrayConstructors(function(TA, N) {
sample.map(function() { sample.map(function() {
results.push(arguments); results.push(arguments);
return N(0); return 0;
}); });
assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results.length, 2, "results.length");
@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA, N) {
assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][1], 0, "results[0][1] - k");
assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k");
assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); assert.sameValue(results[0][0], 7, "results[0][0] - kValue");
assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); assert.sameValue(results[1][0], 8, "results[1][0] - kValue");
}); });

View File

@ -19,13 +19,13 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample = new TA(N([1, 2, 4])); var sample = new TA([1, 2, 4]);
var result = sample.map(function(v) { var result = sample.map(function(v) {
return v * N(3); return v * 3;
}); });
assert.sameValue(result[0], N(3), "result[0] == 3"); assert.sameValue(result[0], 3, "result[0] == 3");
assert.sameValue(result[1], N(6), "result[1] == 6"); assert.sameValue(result[1], 6, "result[1] == 6");
assert.sameValue(result[2], N(12), "result[2] == 12"); assert.sameValue(result[2], 12, "result[2] == 12");
}); });

View File

@ -10,16 +10,16 @@ includes: [testTypedArray.js]
features: [TypedArray] features: [TypedArray]
---*/ ---*/
testWithTypedArrayConstructors(function(TA, N) { testWithTypedArrayConstructors(function(TA) {
var sample1 = new TA(3); var sample1 = new TA(3);
sample1[1] = N(1); sample1[1] = 1;
sample1.map(function() { sample1.map(function() {
return N(42); return 42;
}); });
assert.sameValue(sample1[0], N(0), "[0] == 0"); assert.sameValue(sample1[0], 0, "[0] == 0");
assert.sameValue(sample1[1], N(1), "[1] == 1"); assert.sameValue(sample1[1], 1, "[1] == 1");
assert.sameValue(sample1[2], N(0), "[2] == 0"); assert.sameValue(sample1[2], 0, "[2] == 0");
}); });

Some files were not shown because too many files have changed in this diff Show More