blob: 05d25e6a8531c4f40f39e3a01c6e47bf642c9a5b [file] [log] [blame]
This test checks the behavior of the reduceRight() method on a number of objects.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS [0,1,2,3].reduceRight(function(a,b){ return a + b; }) is 6
PASS [1,2,3].reduceRight(function(a,b){ return a + b; }) is 6
PASS [0,1,2,3].reduceRight(function(a,b){ return a + b; }, 4) is 10
PASS [1,2,3].reduceRight(function(a,b){ return a + b; }, 4) is 10
PASS toObject([0,1,2,3]).reduceRight(function(a,b){ return a + b; }) is 6
PASS toObject([1,2,3]).reduceRight(function(a,b){ return a + b; }) is 6
PASS toObject([0,1,2,3]).reduceRight(function(a,b){ return a + b; }, 4) is 10
PASS toObject([1,2,3]).reduceRight(function(a,b){ return a + b; }, 4) is 10
PASS toUnorderedObject([0,1,2,3]).reduceRight(function(a,b){ return a + b; }) is 6
PASS toUnorderedObject([1,2,3]).reduceRight(function(a,b){ return a + b; }) is 6
PASS toUnorderedObject([0,1,2,3]).reduceRight(function(a,b){ return a + b; }, 4) is 10
PASS toUnorderedObject([1,2,3]).reduceRight(function(a,b){ return a + b; }, 4) is 10
PASS sparseArray.reduceRight(function(a,b){ return a + b; }, 0) is 10
PASS toObject(sparseArray).reduceRight(function(a,b){ return a + b; }, 0) is 10
PASS sparseArray.reduceRight(function(a,b){ callCount++; }); callCount is 0
PASS toObject(sparseArray).reduceRight(function(a,b){ callCount++; }); callCount is 0
PASS sparseArray.reduceRight(function(a,b){ callCount++; }, 0); callCount is 1
PASS toObject(sparseArray).reduceRight(function(a,b){ callCount++; }, 0); callCount is 1
PASS [0,1,2,3,4].reduceRight(function(a,b){ callCount++; }, 0); callCount is 5
PASS [0,1,2,3,4].reduceRight(function(a,b){ callCount++; }); callCount is 4
PASS [1, 2, 3, 4].reduceRight(function(a,b, i, thisObj){ thisObj.length--; callCount++; return a + b; }, 0); callCount is 4
PASS [1, 2, 3, 4].reduceRight(function(a,b, i, thisObj){ thisObj.length = 1; callCount++; return a + b; }, 0); callCount is 2
PASS [1, 2, 3, 4].reduceRight(function(a,b, i, thisObj){ thisObj.length++; callCount++; return a + b; }, 0); callCount is 4
PASS toObject([1, 2, 3, 4]).reduceRight(function(a,b, i, thisObj){ thisObj.length--; callCount++; return a + b; }, 0); callCount is 4
PASS toObject([1, 2, 3, 4]).reduceRight(function(a,b, i, thisObj){ thisObj.length++; callCount++; return a + b; }, 0); callCount is 4
PASS [[0,1], [2,3], [4,5]].reduceRight(function(a,b) {return a.concat(b);}, []) is [4,5,2,3,0,1]
PASS toObject([[0,1], [2,3], [4,5]]).reduceRight(function(a,b) {return a.concat(b);}, []) is [4,5,2,3,0,1]
PASS toObject([0,1,2,3,4,5]).reduceRight(function(a,b,i) {return a.concat([i,b]);}, []) is [5,5,4,4,3,3,2,2,1,1,0,0]
PASS toUnorderedObject([[0,1], [2,3], [4,5]]).reduceRight(function(a,b) {return a.concat(b);}, []) is [4,5,2,3,0,1]
PASS toUnorderedObject([0,1,2,3,4,5]).reduceRight(function(a,b,i) {return a.concat([i,b]);}, []) is [5,5,4,4,3,3,2,2,1,1,0,0]
PASS [0,1,2,3,4,5].reduceRight(function(a,b,i) {return a.concat([i,b]);}, []) is [5,5,4,4,3,3,2,2,1,1,0,0]
PASS [2,3].reduceRight(function() {'use strict'; return this;}) is undefined
PASS Array.prototype.reduceRight.call(negativeLengthObject, function (a, b) { return a + b; }, 100) is 100
PASS successfullyParsed is true
TEST COMPLETE