mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Replace runTestCase with assert helpers [test/built-ins/Array/prototype/reduce]
This commit is contained in:
parent
976a687b27
commit
df43797c70
@ -4,13 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-0-1
|
es5id: 15.4.4.21-0-1
|
||||||
description: Array.prototype.reduce must exist as a function
|
description: Array.prototype.reduce must exist as a function
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var f = Array.prototype.reduce;
|
var f = Array.prototype.reduce;
|
||||||
if (typeof(f) === "function") {
|
|
||||||
return true;
|
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,12 +4,6 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-0-2
|
es5id: 15.4.4.21-0-2
|
||||||
description: Array.prototype.reduce.length must be 1
|
description: Array.prototype.reduce.length must be 1
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
assert.sameValue(Array.prototype.reduce.length, 1, 'Array.prototype.reduce.length');
|
||||||
if (Array.prototype.reduce.length === 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-11
|
es5id: 15.4.4.21-1-11
|
||||||
description: Array.prototype.reduce applied to Date object
|
description: Array.prototype.reduce applied to Date object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof Date;
|
return obj instanceof Date;
|
||||||
}
|
}
|
||||||
@ -16,6 +14,4 @@ function testcase() {
|
|||||||
obj.length = 1;
|
obj.length = 1;
|
||||||
obj[0] = 1;
|
obj[0] = 1;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-12
|
es5id: 15.4.4.21-1-12
|
||||||
description: Array.prototype.reduce applied to RegExp object
|
description: Array.prototype.reduce applied to RegExp object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof RegExp;
|
return obj instanceof RegExp;
|
||||||
}
|
}
|
||||||
@ -16,6 +14,4 @@ function testcase() {
|
|||||||
obj.length = 1;
|
obj.length = 1;
|
||||||
obj[0] = 1;
|
obj[0] = 1;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-14
|
es5id: 15.4.4.21-1-14
|
||||||
description: Array.prototype.reduce applied to Error object
|
description: Array.prototype.reduce applied to Error object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof Error;
|
return obj instanceof Error;
|
||||||
}
|
}
|
||||||
@ -16,6 +14,4 @@ function testcase() {
|
|||||||
obj.length = 1;
|
obj.length = 1;
|
||||||
obj[0] = 1;
|
obj[0] = 1;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-15
|
es5id: 15.4.4.21-1-15
|
||||||
description: Array.prototype.reduce applied to the Arguments object
|
description: Array.prototype.reduce applied to the Arguments object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return ('[object Arguments]' === Object.prototype.toString.call(obj));
|
return ('[object Arguments]' === Object.prototype.toString.call(obj));
|
||||||
}
|
}
|
||||||
@ -17,6 +14,4 @@ function testcase() {
|
|||||||
return arguments;
|
return arguments;
|
||||||
}("a", "b"));
|
}("a", "b"));
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-4
|
es5id: 15.4.4.21-1-4
|
||||||
description: Array.prototype.reduce applied to Boolean object
|
description: Array.prototype.reduce applied to Boolean object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof Boolean;
|
return obj instanceof Boolean;
|
||||||
}
|
}
|
||||||
@ -17,6 +15,4 @@ function testcase() {
|
|||||||
obj[0] = 11;
|
obj[0] = 11;
|
||||||
obj[1] = 12;
|
obj[1] = 12;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-6
|
es5id: 15.4.4.21-1-6
|
||||||
description: Array.prototype.reduce applied to Number object
|
description: Array.prototype.reduce applied to Number object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof Number;
|
return obj instanceof Number;
|
||||||
}
|
}
|
||||||
@ -16,6 +14,5 @@ function testcase() {
|
|||||||
obj.length = 2;
|
obj.length = 2;
|
||||||
obj[0] = 11;
|
obj[0] = 11;
|
||||||
obj[1] = 12;
|
obj[1] = 12;
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
|
||||||
}
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,10 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-7
|
es5id: 15.4.4.21-1-7
|
||||||
description: Array.prototype.reduce applied to string primitive
|
description: Array.prototype.reduce applied to string primitive
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof String;
|
return obj instanceof String;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.prototype.reduce.call("abc", callbackfn, 1);
|
assert(Array.prototype.reduce.call("abc", callbackfn, 1), 'Array.prototype.reduce.call("abc", callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,12 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-8
|
es5id: 15.4.4.21-1-8
|
||||||
description: Array.prototype.reduce applied to String object
|
description: Array.prototype.reduce applied to String object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof String;
|
return obj instanceof String;
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = new String("abc");
|
var obj = new String("abc");
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-9
|
es5id: 15.4.4.21-1-9
|
||||||
description: Array.prototype.reduce applied to Function object
|
description: Array.prototype.reduce applied to Function object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return obj instanceof Function;
|
return obj instanceof Function;
|
||||||
}
|
}
|
||||||
@ -18,6 +16,4 @@ function testcase() {
|
|||||||
obj[0] = 11;
|
obj[0] = 11;
|
||||||
obj[1] = 9;
|
obj[1] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1);
|
assert(Array.prototype.reduce.call(obj, callbackfn, 1), 'Array.prototype.reduce.call(obj, callbackfn, 1) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,25 +6,17 @@ es5id: 15.4.4.21-10-1
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce doesn't mutate the Array on which it is
|
Array.prototype.reduce doesn't mutate the Array on which it is
|
||||||
called on
|
called on
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
var srcArr = [1,2,3,4,5];
|
var srcArr = [1,2,3,4,5];
|
||||||
srcArr.reduce(callbackfn);
|
srcArr.reduce(callbackfn);
|
||||||
if(srcArr[0] === 1 &&
|
|
||||||
srcArr[1] === 2 &&
|
|
||||||
srcArr[2] === 3 &&
|
|
||||||
srcArr[3] === 4 &&
|
|
||||||
srcArr[4] === 5)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
assert.sameValue(srcArr[0], 1, 'srcArr[0]');
|
||||||
runTestCase(testcase);
|
assert.sameValue(srcArr[1], 2, 'srcArr[1]');
|
||||||
|
assert.sameValue(srcArr[2], 3, 'srcArr[2]');
|
||||||
|
assert.sameValue(srcArr[3], 4, 'srcArr[3]');
|
||||||
|
assert.sameValue(srcArr[4], 5, 'srcArr[4]');
|
||||||
|
@ -6,20 +6,12 @@ es5id: 15.4.4.21-10-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce reduces the array in ascending order of
|
Array.prototype.reduce reduces the array in ascending order of
|
||||||
indices
|
indices
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
return prevVal + curVal;
|
return prevVal + curVal;
|
||||||
}
|
}
|
||||||
var srcArr = ['1','2','3','4','5'];
|
var srcArr = ['1','2','3','4','5'];
|
||||||
if(srcArr.reduce(callbackfn) === '12345')
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
assert.sameValue(srcArr.reduce(callbackfn), '12345', 'srcArr.reduce(callbackfn)');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,16 +4,12 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-10-3
|
es5id: 15.4.4.21-10-3
|
||||||
description: Array.prototype.reduce - subclassed array of length 1
|
description: Array.prototype.reduce - subclassed array of length 1
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = [1];
|
foo.prototype = [1];
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
|
|
||||||
function cb(){}
|
function cb(){}
|
||||||
if(f.reduce(cb) === 1)
|
|
||||||
return true;
|
assert.sameValue(f.reduce(cb), 1, 'f.reduce(cb)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,16 +4,12 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-10-4
|
es5id: 15.4.4.21-10-4
|
||||||
description: Array.prototype.reduce - subclassed array with length more than 1
|
description: Array.prototype.reduce - subclassed array with length more than 1
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = new Array(1, 2, 3, 4);
|
foo.prototype = new Array(1, 2, 3, 4);
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
|
|
||||||
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
||||||
if(f.reduce(cb) === 10)
|
|
||||||
return true;
|
assert.sameValue(f.reduce(cb), 10, 'f.reduce(cb)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,20 +6,12 @@ es5id: 15.4.4.21-10-5
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce reduces the array in ascending order of
|
Array.prototype.reduce reduces the array in ascending order of
|
||||||
indices(initialvalue present)
|
indices(initialvalue present)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
return prevVal + curVal;
|
return prevVal + curVal;
|
||||||
}
|
}
|
||||||
var srcArr = ['1','2','3','4','5'];
|
var srcArr = ['1','2','3','4','5'];
|
||||||
if(srcArr.reduce(callbackfn,'0') === '012345')
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
assert.sameValue(srcArr.reduce(callbackfn,'0'), '012345', 'srcArr.reduce(callbackfn,"0")');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,12 @@ es5id: 15.4.4.21-10-6
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - subclassed array when initialvalue
|
Array.prototype.reduce - subclassed array when initialvalue
|
||||||
provided
|
provided
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = [1,2,3,4];
|
foo.prototype = [1,2,3,4];
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
|
|
||||||
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
||||||
if(f.reduce(cb,-1) === 9)
|
|
||||||
return true;
|
assert.sameValue(f.reduce(cb,-1), 9, 'f.reduce(cb,-1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,12 @@ es5id: 15.4.4.21-10-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - subclassed array with length 1 and
|
Array.prototype.reduce - subclassed array with length 1 and
|
||||||
initialvalue provided
|
initialvalue provided
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = [1];
|
foo.prototype = [1];
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
|
|
||||||
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
||||||
if(f.reduce(cb,-1) === 0)
|
|
||||||
return true;
|
assert.sameValue(f.reduce(cb,-1), 0, 'f.reduce(cb,-1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-10-8
|
es5id: 15.4.4.21-10-8
|
||||||
description: Array.prototype.reduce doesn't visit expandos
|
description: Array.prototype.reduce doesn't visit expandos
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var callCnt = 0;
|
var callCnt = 0;
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
@ -20,10 +17,4 @@ function testcase() {
|
|||||||
srcArr[true] = 11;
|
srcArr[true] = 11;
|
||||||
srcArr.reduce(callbackfn);
|
srcArr.reduce(callbackfn);
|
||||||
|
|
||||||
if(callCnt == 4)
|
assert.sameValue(callCnt, 4, 'callCnt');
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-1
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is own data property on an
|
Array.prototype.reduce - 'length' is own data property on an
|
||||||
Array-like object
|
Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -22,6 +19,4 @@ function testcase() {
|
|||||||
length: 2
|
length: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-10
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an inherited accessor property
|
an inherited accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -32,6 +29,4 @@ function testcase() {
|
|||||||
child[1] = 11;
|
child[1] = 11;
|
||||||
child[2] = 9;
|
child[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), true, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-11
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an own accessor property without a get function
|
an own accessor property without a get function
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
accessed = true;
|
accessed = true;
|
||||||
@ -25,6 +22,5 @@ function testcase() {
|
|||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-13
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object that 'length'
|
Array.prototype.reduce applied to Array-like object that 'length'
|
||||||
is inherited accessor property without a get function
|
is inherited accessor property without a get function
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -30,6 +27,5 @@ function testcase() {
|
|||||||
child[0] = 11;
|
child[0] = 11;
|
||||||
child[1] = 12;
|
child[1] = 12;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), 1, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-14
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to the Array-like object that
|
Array.prototype.reduce applied to the Array-like object that
|
||||||
'length' property doesn't exist
|
'length' property doesn't exist
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -19,7 +16,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-17
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to the Arguments object, which
|
Array.prototype.reduce applied to the Arguments object, which
|
||||||
implements its own property get method
|
implements its own property get method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -20,6 +17,4 @@ function testcase() {
|
|||||||
return Array.prototype.reduce.call(arguments, callbackfn, 1);
|
return Array.prototype.reduce.call(arguments, callbackfn, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return func(12, 11) === true;
|
assert.sameValue(func(12, 11), true, 'func(12, 11)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-2-18
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to String object, which implements
|
Array.prototype.reduce applied to String object, which implements
|
||||||
its own property get method
|
its own property get method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 3);
|
return (obj.length === 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
var str = new String("012");
|
var str = new String("012");
|
||||||
|
|
||||||
return Array.prototype.reduce.call(str, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(str, callbackfn, 1), true, 'Array.prototype.reduce.call(str, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-19
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Function object, which
|
Array.prototype.reduce applied to Function object, which
|
||||||
implements its own property get method
|
implements its own property get method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -22,6 +19,4 @@ function testcase() {
|
|||||||
fun[1] = 11;
|
fun[1] = 11;
|
||||||
fun[2] = 9;
|
fun[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(fun, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(fun, callbackfn, 1), true, 'Array.prototype.reduce.call(fun, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,10 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-2-2
|
es5id: 15.4.4.21-2-2
|
||||||
description: Array.prototype.reduce - 'length' is own data property on an Array
|
description: Array.prototype.reduce - 'length' is own data property on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [12, 11].reduce(callbackfn, 1) === true;
|
assert.sameValue([12, 11].reduce(callbackfn, 1), true, '[12, 11].reduce(callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-3
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is an own data property that
|
Array.prototype.reduce - 'length' is an own data property that
|
||||||
overrides an inherited data property on an Array-like object
|
overrides an inherited data property on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -26,6 +23,4 @@ function testcase() {
|
|||||||
child[1] = 11;
|
child[1] = 11;
|
||||||
child[2] = 9;
|
child[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), true, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-5
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an own data property that overrides an inherited accessor property
|
an own data property that overrides an inherited accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -36,6 +33,4 @@ function testcase() {
|
|||||||
child[1] = 11;
|
child[1] = 11;
|
||||||
child[2] = 9;
|
child[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), true, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-6
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an inherited data property
|
an inherited data property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -25,6 +22,4 @@ function testcase() {
|
|||||||
child[1] = 11;
|
child[1] = 11;
|
||||||
child[2] = 9;
|
child[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), true, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an own accessor property
|
an own accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -28,6 +25,4 @@ function testcase() {
|
|||||||
obj[1] = 11;
|
obj[1] = 11;
|
||||||
obj[2] = 9;
|
obj[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-2-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an own accessor property that overrides an inherited data property
|
an own accessor property that overrides an inherited data property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -33,6 +30,4 @@ function testcase() {
|
|||||||
child[1] = 11;
|
child[1] = 11;
|
||||||
child[2] = 9;
|
child[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), true, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce applied to Array-like object, 'length' is
|
Array.prototype.reduce applied to Array-like object, 'length' is
|
||||||
an own accessor property that overrides an inherited accessor
|
an own accessor property that overrides an inherited accessor
|
||||||
property
|
property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (obj.length === 2);
|
return (obj.length === 2);
|
||||||
}
|
}
|
||||||
@ -41,6 +38,4 @@ function testcase() {
|
|||||||
child[1] = 11;
|
child[1] = 11;
|
||||||
child[2] = 9;
|
child[2] = 9;
|
||||||
|
|
||||||
return Array.prototype.reduce.call(child, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(child, callbackfn, 1), true, 'Array.prototype.reduce.call(child, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-3-1
|
es5id: 15.4.4.21-3-1
|
||||||
description: Array.prototype.reduce - value of 'length' is undefined
|
description: Array.prototype.reduce - value of 'length' is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -18,6 +15,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 0, 1: 1, length: undefined };
|
var obj = { 0: 0, 1: 1, length: undefined };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-10
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is number primitive
|
Array.prototype.reduce - value of 'length' is number primitive
|
||||||
(value is NaN)
|
(value is NaN)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -20,6 +17,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 9, length: NaN };
|
var obj = { 0: 9, length: NaN };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-11
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is a string containing a
|
Array.prototype.reduce - 'length' is a string containing a
|
||||||
positive number
|
positive number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: "2" };
|
var obj = { 1: 11, 2: 9, length: "2" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-12
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is a string containing a
|
Array.prototype.reduce - 'length' is a string containing a
|
||||||
negative number
|
negative number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: "-4294967294" };
|
var obj = { 1: 11, 2: 9, length: "-4294967294" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-13
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is a string containing a decimal
|
Array.prototype.reduce - 'length' is a string containing a decimal
|
||||||
number
|
number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: "2.5" };
|
var obj = { 1: 11, 2: 9, length: "2.5" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-3-14
|
es5id: 15.4.4.21-3-14
|
||||||
description: Array.prototype.reduce - 'length' is a string containing -Infinity
|
description: Array.prototype.reduce - 'length' is a string containing -Infinity
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed2 = false;
|
var accessed2 = false;
|
||||||
|
|
||||||
function callbackfn2(prevVal, curVal, idx, obj) {
|
function callbackfn2(prevVal, curVal, idx, obj) {
|
||||||
@ -18,7 +15,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj2 = { 0: 9, length: "-Infinity" };
|
var obj2 = { 0: 9, length: "-Infinity" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj2, callbackfn2, 1) === 1
|
assert.sameValue(Array.prototype.reduce.call(obj2, callbackfn2, 1), 1, 'Array.prototype.reduce.call(obj2, callbackfn2, 1)');
|
||||||
&& !accessed2;
|
assert.sameValue(accessed2, false, 'accessed2');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is a string containing an
|
Array.prototype.reduce - 'length' is a string containing an
|
||||||
exponential number
|
exponential number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: "2E0" };
|
var obj = { 1: 11, 2: 9, length: "2E0" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-16
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is a string containing a hex
|
Array.prototype.reduce - 'length' is a string containing a hex
|
||||||
number
|
number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: "0x0002" };
|
var obj = { 1: 11, 2: 9, length: "0x0002" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-17
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'length' is a string containing a number
|
Array.prototype.reduce - 'length' is a string containing a number
|
||||||
with leading zeros
|
with leading zeros
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: "0002.00" };
|
var obj = { 1: 11, 2: 9, length: "0002.00" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-18
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a string that can't
|
Array.prototype.reduce - value of 'length' is a string that can't
|
||||||
convert to a number
|
convert to a number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
accessed = true;
|
accessed = true;
|
||||||
@ -19,6 +16,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 9, length: "asdf!_" };
|
var obj = { 0: 9, length: "asdf!_" };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-19
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is an Object which has
|
Array.prototype.reduce - value of 'length' is an Object which has
|
||||||
an own toString method
|
an own toString method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
@ -25,6 +22,4 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,18 +6,12 @@ es5id: 15.4.4.21-3-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a boolean (value is
|
Array.prototype.reduce - value of 'length' is a boolean (value is
|
||||||
true)
|
true)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 0);
|
return (curVal === 11 && idx === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 9, length: true };
|
var obj = { 0: 11, 1: 9, length: true };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-20
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is an object which has
|
Array.prototype.reduce - value of 'length' is an object which has
|
||||||
an own valueOf method
|
an own valueOf method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
@ -25,6 +22,4 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - 'length' is an object that has an own
|
Array.prototype.reduce - 'length' is an object that has an own
|
||||||
valueOf method that returns an object and toString method that
|
valueOf method that returns an object and toString method that
|
||||||
returns a string
|
returns a string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var valueOfOccured = false;
|
var valueOfOccured = false;
|
||||||
var toStringOccured = false;
|
var toStringOccured = false;
|
||||||
|
|
||||||
@ -34,6 +31,6 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true && valueOfOccured && toStringOccured;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert(valueOfOccured, 'valueOfOccured !== true');
|
||||||
runTestCase(testcase);
|
assert(toStringOccured, 'toStringOccured !== true');
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-23
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce uses inherited valueOf method - 'length' is
|
Array.prototype.reduce uses inherited valueOf method - 'length' is
|
||||||
an object with an own toString and inherited valueOf methods
|
an object with an own toString and inherited valueOf methods
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var valueOfAccessed = false;
|
var valueOfAccessed = false;
|
||||||
var toStringAccessed = false;
|
var toStringAccessed = false;
|
||||||
|
|
||||||
@ -41,6 +38,6 @@ function testcase() {
|
|||||||
length: child
|
length: child
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true && valueOfAccessed && !toStringAccessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||||
runTestCase(testcase);
|
assert.sameValue(toStringAccessed, false, 'toStringAccessed');
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.21-3-24
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a positive
|
Array.prototype.reduce - value of 'length' is a positive
|
||||||
non-integer, ensure truncation occurs in the proper direction
|
non-integer, ensure truncation occurs in the proper direction
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
@ -20,6 +18,4 @@ function testcase() {
|
|||||||
length: 2.685
|
length: 2.685
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-25
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a negative
|
Array.prototype.reduce - value of 'length' is a negative
|
||||||
non-integer
|
non-integer
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
@ -21,6 +18,4 @@ function testcase() {
|
|||||||
length: -4294967294.5
|
length: -4294967294.5
|
||||||
};
|
};
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-3-3
|
es5id: 15.4.4.21-3-3
|
||||||
description: Array.prototype.reduce - value of 'length' is a number (value is 0)
|
description: Array.prototype.reduce - value of 'length' is a number (value is 0)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -18,6 +15,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 1, 1: 1, length: 0 };
|
var obj = { 0: 1, 1: 1, length: 0 };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-4
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a number (value is
|
Array.prototype.reduce - value of 'length' is a number (value is
|
||||||
+0)
|
+0)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -20,6 +17,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 11, length: +0 };
|
var obj = { 0: 11, length: +0 };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-5
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a number (value is
|
Array.prototype.reduce - value of 'length' is a number (value is
|
||||||
-0)
|
-0)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -20,6 +17,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 11, length: -0 };
|
var obj = { 0: 11, length: -0 };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-6
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a number (value is
|
Array.prototype.reduce - value of 'length' is a number (value is
|
||||||
positive)
|
positive)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: 2 };
|
var obj = { 1: 11, 2: 9, length: 2 };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === true;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), true, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,17 +6,12 @@ es5id: 15.4.4.21-3-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a number (value is
|
Array.prototype.reduce - value of 'length' is a number (value is
|
||||||
negative)
|
negative)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal === 11 && idx === 1);
|
return (curVal === 11 && idx === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 1: 11, 2: 9, length: -4294967294 };
|
var obj = { 1: 11, 2: 9, length: -4294967294 };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-3-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - value of 'length' is a number (value is
|
Array.prototype.reduce - value of 'length' is a number (value is
|
||||||
-Infinity)
|
-Infinity)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -19,6 +16,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 9, length: -Infinity };
|
var obj = { 0: 9, length: -Infinity };
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn, 1) === 1 && !accessed;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, 1), 1, 'Array.prototype.reduce.call(obj, callbackfn, 1)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,13 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-4-12
|
es5id: 15.4.4.21-4-12
|
||||||
description: Array.prototype.reduce - 'callbackfn' is a function
|
description: Array.prototype.reduce - 'callbackfn' is a function
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
accessed = true;
|
accessed = true;
|
||||||
return curVal > 10;
|
return curVal > 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [11, 9].reduce(callbackfn, 1) === false && accessed;
|
assert.sameValue([11, 9].reduce(callbackfn, 1), false, '[11, 9].reduce(callbackfn, 1)');
|
||||||
}
|
assert(accessed, 'accessed !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,12 @@ es5id: 15.4.4.21-5-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - 'initialValue' is returned if 'len' is 0
|
Array.prototype.reduce - 'initialValue' is returned if 'len' is 0
|
||||||
and 'initialValue' is present
|
and 'initialValue' is present
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
accessed = true;
|
accessed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [].reduce(callbackfn, 3) === 3 && !accessed;
|
assert.sameValue([].reduce(callbackfn, 3), 3, '[].reduce(callbackfn, 3)');
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - modifications to length don't change
|
Array.prototype.reduce - modifications to length don't change
|
||||||
number of iterations in step 9
|
number of iterations in step 9
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
@ -25,6 +22,4 @@ function testcase() {
|
|||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
return Array.prototype.reduce.call(obj, callbackfn) === 3;
|
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn), 3, 'Array.prototype.reduce.call(obj, callbackfn)');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-8-b-3
|
es5id: 15.4.4.21-8-b-3
|
||||||
description: Array.prototype.reduce - loop is broken once 'kPresent' is true
|
description: Array.prototype.reduce - loop is broken once 'kPresent' is true
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var called = 0;
|
var called = 0;
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
var firstCalled = 0;
|
var firstCalled = 0;
|
||||||
@ -40,6 +37,7 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
return testResult && firstCalled === 1 && secondCalled === 1;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
assert.sameValue(firstCalled, 1, 'firstCalled');
|
||||||
|
assert.sameValue(secondCalled, 1, 'secondCalled');
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-1
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is own data
|
Array.prototype.reduce - element to be retrieved is own data
|
||||||
property on an Array-like object
|
property on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -20,6 +17,5 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { 0: 0, 1: 1, 2: 2, length: 2 };
|
var obj = { 0: 0, 1: 1, 2: 2, length: 2 };
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-10
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - when element to be retrieved is own
|
Array.prototype.reduce - when element to be retrieved is own
|
||||||
accessor property on an Array
|
accessor property on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -28,6 +26,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - element to be retrieved is own accessor
|
Array.prototype.reduce - element to be retrieved is own accessor
|
||||||
property that overrides an inherited data property on an
|
property that overrides an inherited data property on an
|
||||||
Array-like object
|
Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -35,6 +32,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,10 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - element to be retrieved is own accessor
|
Array.prototype.reduce - element to be retrieved is own accessor
|
||||||
property that overrides an inherited accessor property on an
|
property that overrides an inherited accessor property on an
|
||||||
Array-like object
|
Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
@ -42,6 +40,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is inherited
|
Array.prototype.reduce - element to be retrieved is inherited
|
||||||
accessor property on an Array-like object
|
accessor property on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -34,6 +31,5 @@ function testcase() {
|
|||||||
child.length = 3;
|
child.length = 3;
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-17
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is own accessor
|
Array.prototype.reduce - element to be retrieved is own accessor
|
||||||
property without a get function on an Array-like object
|
property without a get function on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -26,6 +23,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-18
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is own accessor
|
Array.prototype.reduce - element to be retrieved is own accessor
|
||||||
property without a get function on an Array
|
property without a get function on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -26,6 +23,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is own data
|
Array.prototype.reduce - element to be retrieved is own data
|
||||||
property on an Array
|
property on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -20,6 +17,5 @@ function testcase() {
|
|||||||
|
|
||||||
var arr = [0, 1, 2];
|
var arr = [0, 1, 2];
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-21
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is inherited
|
Array.prototype.reduce - element to be retrieved is inherited
|
||||||
accessor property without a get function on an Array-like object
|
accessor property without a get function on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -32,6 +29,5 @@ function testcase() {
|
|||||||
child.length = 3;
|
child.length = 3;
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - This object is the Arguments object which
|
Array.prototype.reduce - This object is the Arguments object which
|
||||||
implements its own property get method (number of arguments is
|
implements its own property get method (number of arguments is
|
||||||
less than number of parameters)
|
less than number of parameters)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -24,6 +21,5 @@ function testcase() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
func(0, 1);
|
func(0, 1);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - This object is the Arguments object which
|
Array.prototype.reduce - This object is the Arguments object which
|
||||||
implements its own property get method (number of arguments equals
|
implements its own property get method (number of arguments equals
|
||||||
number of parameters)
|
number of parameters)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 2) {
|
if (idx === 2) {
|
||||||
@ -25,6 +22,5 @@ function testcase() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
func(0, 1, 2);
|
func(0, 1, 2);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - This object is the Arguments object which
|
Array.prototype.reduce - This object is the Arguments object which
|
||||||
implements its own property get method (number of arguments is
|
implements its own property get method (number of arguments is
|
||||||
greater than number of parameters)
|
greater than number of parameters)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 3) {
|
if (idx === 3) {
|
||||||
@ -26,6 +23,5 @@ function testcase() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
func(0, 1, 2, 3);
|
func(0, 1, 2, 3);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-28
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - applied to String object, which
|
Array.prototype.reduce - applied to String object, which
|
||||||
implements its own property get method
|
implements its own property get method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -20,7 +17,5 @@ function testcase() {
|
|||||||
|
|
||||||
var str = new String("012");
|
var str = new String("012");
|
||||||
Array.prototype.reduce.call(str, callbackfn);
|
Array.prototype.reduce.call(str, callbackfn);
|
||||||
return testResult;
|
|
||||||
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-29
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - applied to Function object which
|
Array.prototype.reduce - applied to Function object which
|
||||||
implements its own property get method
|
implements its own property get method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -27,7 +24,5 @@ function testcase() {
|
|||||||
obj[3] = 3;
|
obj[3] = 3;
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return testResult;
|
|
||||||
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - element to be retrieved is own data
|
Array.prototype.reduce - element to be retrieved is own data
|
||||||
property that overrides an inherited data property on an
|
property that overrides an inherited data property on an
|
||||||
Array-like object
|
Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -29,7 +26,5 @@ function testcase() {
|
|||||||
child.length = 3;
|
child.length = 3;
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element changed by getter on current
|
Array.prototype.reduce - element changed by getter on current
|
||||||
iterations is observed in subsequent iterations on an Array
|
iterations is observed in subsequent iterations on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -41,6 +38,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - element changed by getter on current
|
Array.prototype.reduce - element changed by getter on current
|
||||||
iterations is observed in subsequent iterations on an Array-like
|
iterations is observed in subsequent iterations on an Array-like
|
||||||
object
|
object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -42,7 +39,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return testResult;
|
|
||||||
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - element to be retrieved is own data
|
Array.prototype.reduce - element to be retrieved is own data
|
||||||
property that overrides an inherited accessor property on an
|
property that overrides an inherited accessor property on an
|
||||||
Array-like object
|
Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -40,6 +37,5 @@ function testcase() {
|
|||||||
child[1] = "1";
|
child[1] = "1";
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is inherited data
|
Array.prototype.reduce - element to be retrieved is inherited data
|
||||||
property on an Array-like object
|
property on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -26,6 +23,5 @@ function testcase() {
|
|||||||
child.length = 3;
|
child.length = 3;
|
||||||
|
|
||||||
Array.prototype.reduce.call(child, callbackfn);
|
Array.prototype.reduce.call(child, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-8-b-iii-1-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - element to be retrieved is own accessor
|
Array.prototype.reduce - element to be retrieved is own accessor
|
||||||
property on an Array-like object
|
property on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
if (idx === 1) {
|
if (idx === 1) {
|
||||||
@ -27,6 +24,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.21-9-1
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce doesn't consider new elements added to
|
Array.prototype.reduce doesn't consider new elements added to
|
||||||
array after it is called
|
array after it is called
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
arr[5] = 6;
|
arr[5] = 6;
|
||||||
arr[2] = 3;
|
arr[2] = 3;
|
||||||
@ -17,6 +15,5 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arr = [1, 2, , 4, '5'];
|
var arr = [1, 2, , 4, '5'];
|
||||||
return arr.reduce(callbackfn) === "105";
|
|
||||||
}
|
assert.sameValue(arr.reduce(callbackfn), "105", 'arr.reduce(callbackfn)');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-10
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce called with an initial value doesn't
|
Array.prototype.reduce called with an initial value doesn't
|
||||||
consider new elements added to array after it is called
|
consider new elements added to array after it is called
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
arr[5] = 6;
|
arr[5] = 6;
|
||||||
arr[2] = 3;
|
arr[2] = 3;
|
||||||
@ -18,6 +15,5 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arr = [1,2,,4,'5'];
|
var arr = [1,2,,4,'5'];
|
||||||
return arr.reduce(callbackfn, "") === "12345";
|
|
||||||
}
|
assert.sameValue(arr.reduce(callbackfn, ""), "12345", 'arr.reduce(callbackfn, "")');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce considers new value of elements in array
|
Array.prototype.reduce considers new value of elements in array
|
||||||
after it is called
|
after it is called
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
arr[3] = -2;
|
arr[3] = -2;
|
||||||
@ -19,8 +16,5 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arr = [1,2,3,4,5];
|
var arr = [1,2,3,4,5];
|
||||||
if(arr.reduce(callbackfn) === 3)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
assert.sameValue(arr.reduce(callbackfn), 3, 'arr.reduce(callbackfn)');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-4
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce doesn't visit deleted elements when
|
Array.prototype.reduce doesn't visit deleted elements when
|
||||||
Array.length is decreased
|
Array.length is decreased
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
arr.length = 2;
|
arr.length = 2;
|
||||||
@ -18,8 +15,5 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arr = [1,2,3,4,5];
|
var arr = [1,2,3,4,5];
|
||||||
if(arr.reduce(callbackfn) === 3 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
assert.sameValue(arr.reduce(callbackfn), 3, 'arr.reduce(callbackfn)');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-5
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - callbackfn not called for array with one
|
Array.prototype.reduce - callbackfn not called for array with one
|
||||||
element
|
element
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var callCnt = 0;
|
var callCnt = 0;
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
@ -19,7 +16,6 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var arr = [1];
|
var arr = [1];
|
||||||
if(arr.reduce(callbackfn) === 1 && callCnt === 0 )
|
|
||||||
return true;
|
assert.sameValue(arr.reduce(callbackfn), 1, 'arr.reduce(callbackfn)');
|
||||||
}
|
assert.sameValue(callCnt, 0, 'callCnt');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.21-9-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce stops calling callbackfn once the array is
|
Array.prototype.reduce stops calling callbackfn once the array is
|
||||||
deleted during the call
|
deleted during the call
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
delete o.arr;
|
delete o.arr;
|
||||||
return prevVal + curVal;
|
return prevVal + curVal;
|
||||||
@ -17,6 +15,6 @@ function testcase() {
|
|||||||
|
|
||||||
var o = new Object();
|
var o = new Object();
|
||||||
o.arr = ['1', 2, 3, 4, 5];
|
o.arr = ['1', 2, 3, 4, 5];
|
||||||
return o.arr.reduce(callbackfn) === "12345" && !o.hasOwnProperty("arr");
|
|
||||||
}
|
assert.sameValue(o.arr.reduce(callbackfn), "12345", 'o.arr.reduce(callbackfn)');
|
||||||
runTestCase(testcase);
|
assert.sameValue(o.hasOwnProperty("arr"), false, 'o.hasOwnProperty("arr")');
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-9-8
|
es5id: 15.4.4.21-9-8
|
||||||
description: Array.prototype.reduce - no observable effects occur if 'len' is 0
|
description: Array.prototype.reduce - no observable effects occur if 'len' is 0
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var callbackAccessed = false;
|
var callbackAccessed = false;
|
||||||
function callbackfn() {
|
function callbackfn() {
|
||||||
@ -26,6 +23,6 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, function () { }, "initialValue");
|
Array.prototype.reduce.call(obj, function () { }, "initialValue");
|
||||||
return !accessed && !callbackAccessed;
|
|
||||||
}
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
runTestCase(testcase);
|
assert.sameValue(callbackAccessed, false, 'callbackAccessed');
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.21-9-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - modifications to length don't change
|
Array.prototype.reduce - modifications to length don't change
|
||||||
number of iterations in step 9
|
number of iterations in step 9
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var called = 0;
|
var called = 0;
|
||||||
function callbackfn(accum, val, idx, obj) {
|
function callbackfn(accum, val, idx, obj) {
|
||||||
called++;
|
called++;
|
||||||
@ -27,6 +25,5 @@ function testcase() {
|
|||||||
|
|
||||||
var newAccum = arr.reduce(callbackfn, "initialValue");
|
var newAccum = arr.reduce(callbackfn, "initialValue");
|
||||||
|
|
||||||
return newAccum === "initialValue01" && called === 2;
|
assert.sameValue(newAccum, "initialValue01", 'newAccum');
|
||||||
}
|
assert.sameValue(called, 2, 'called');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,12 @@ es5id: 15.4.4.21-9-b-1
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce returns initialvalue when Array is empty
|
Array.prototype.reduce returns initialvalue when Array is empty
|
||||||
and initialValue is present
|
and initialValue is present
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj)
|
function callbackfn(prevVal, curVal, idx, obj)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
|
|
||||||
if(arr.reduce(callbackfn,5) === 5)
|
assert.sameValue(arr.reduce(callbackfn,5), 5, 'arr.reduce(callbackfn,5)');
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-14
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - decreasing length of array in step 8
|
Array.prototype.reduce - decreasing length of array in step 8
|
||||||
causes deleted index property not to be visited
|
causes deleted index property not to be visited
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var testResult = true;
|
var testResult = true;
|
||||||
|
|
||||||
@ -33,6 +30,5 @@ function testcase() {
|
|||||||
|
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
|
|
||||||
return testResult && accessed;
|
assert(testResult, 'testResult !== true');
|
||||||
}
|
assert(accessed, 'accessed !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - decreasing length of array in step 8 does
|
Array.prototype.reduce - decreasing length of array in step 8 does
|
||||||
not delete non-configurable properties
|
not delete non-configurable properties
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(accum, val, idx, obj) {
|
function callbackfn(accum, val, idx, obj) {
|
||||||
@ -39,6 +36,4 @@ function testcase() {
|
|||||||
|
|
||||||
arr.reduce(callbackfn);
|
arr.reduce(callbackfn);
|
||||||
|
|
||||||
return testResult;
|
assert(testResult, 'testResult !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-17
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - properties added into own object are
|
Array.prototype.reduce - properties added into own object are
|
||||||
visited on an Array-like object
|
visited on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(accum, val, idx, obj) {
|
function callbackfn(accum, val, idx, obj) {
|
||||||
@ -35,6 +32,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-18
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - properties added into own object are
|
Array.prototype.reduce - properties added into own object are
|
||||||
visited on an Array
|
visited on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(accum, val, idx, obj) {
|
function callbackfn(accum, val, idx, obj) {
|
||||||
@ -35,6 +32,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.reduce(callbackfn, "initialValue");
|
arr.reduce(callbackfn, "initialValue");
|
||||||
return testResult;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - added properties in step 2 are visible
|
Array.prototype.reduce - added properties in step 2 are visible
|
||||||
here
|
here
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(accum, val, idx, obj) {
|
function callbackfn(accum, val, idx, obj) {
|
||||||
@ -31,6 +28,4 @@ function testcase() {
|
|||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
||||||
|
|
||||||
return testResult;
|
assert(testResult, 'testResult !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-21
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - deleting own property causes deleted
|
Array.prototype.reduce - deleting own property causes deleted
|
||||||
index property not to be visited on an Array-like object
|
index property not to be visited on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var testResult = true;
|
var testResult = true;
|
||||||
|
|
||||||
@ -39,6 +36,6 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
||||||
return testResult && accessed;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
assert(accessed, 'accessed !== true');
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-22
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - deleting own property causes deleted
|
Array.prototype.reduce - deleting own property causes deleted
|
||||||
index property not to be visited on an Array
|
index property not to be visited on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var testResult = true;
|
var testResult = true;
|
||||||
|
|
||||||
@ -39,6 +36,6 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.reduce(callbackfn, "initialValue");
|
arr.reduce(callbackfn, "initialValue");
|
||||||
return testResult && accessed;
|
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
assert(accessed, 'accessed !== true');
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-27
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - decreasing length of array causes deleted
|
Array.prototype.reduce - decreasing length of array causes deleted
|
||||||
index property not to be visited
|
index property not to be visited
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var testResult = true;
|
var testResult = true;
|
||||||
|
|
||||||
@ -33,6 +30,5 @@ function testcase() {
|
|||||||
|
|
||||||
arr.reduce(callbackfn, "initialValue");
|
arr.reduce(callbackfn, "initialValue");
|
||||||
|
|
||||||
return testResult && accessed;
|
assert(testResult, 'testResult !== true');
|
||||||
}
|
assert(accessed, 'accessed !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce - decreasing length of array does not
|
Array.prototype.reduce - decreasing length of array does not
|
||||||
delete non-configurable properties
|
delete non-configurable properties
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var testResult = false;
|
var testResult = false;
|
||||||
|
|
||||||
function callbackfn(accum, val, idx, obj) {
|
function callbackfn(accum, val, idx, obj) {
|
||||||
@ -39,6 +36,4 @@ function testcase() {
|
|||||||
|
|
||||||
arr.reduce(callbackfn, "initialValue");
|
arr.reduce(callbackfn, "initialValue");
|
||||||
|
|
||||||
return testResult;
|
assert(testResult, 'testResult !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-9-b-3
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - deleted properties in step 2 are visible
|
Array.prototype.reduce - deleted properties in step 2 are visible
|
||||||
here
|
here
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var testResult = true;
|
var testResult = true;
|
||||||
|
|
||||||
@ -33,6 +30,5 @@ function testcase() {
|
|||||||
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
Array.prototype.reduce.call(obj, callbackfn, "initialValue");
|
||||||
|
|
||||||
return accessed && testResult;
|
assert(accessed, 'accessed !== true');
|
||||||
}
|
assert(testResult, 'testResult !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user