1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3
* Any copyright is dedicated to the Public Domain.
4
* http://creativecommons.org/licenses/publicdomain/
5
* Contributor: Blake Kaplan
8
//-----------------------------------------------------------------------------
9
var BUGNUMBER = 386030;
10
var summary = 'Array.reduce should ignore holes';
15
//-----------------------------------------------------------------------------
17
//-----------------------------------------------------------------------------
22
printBugNumber(BUGNUMBER);
23
printStatus (summary);
25
function add(a, b) { return a + b; }
26
function testreduce(v) { return v == 3 ? "PASS" : "FAIL"; }
33
actual = testreduce(a.reduce(add));
35
actual = "FAIL, reduce";
37
reportCompare(expect, actual, summary + ': 1');
42
actual = testreduce(a.reduceRight(add));
44
actual = "FAIL, reduceRight";
46
reportCompare(expect, actual, summary + ': 2');
51
actual = "FAIL, empty reduce";
55
reportCompare(expect, actual, summary + ': 3');
59
print(a.reduceRight(add));
60
actual = "FAIL, empty reduceRight";
64
reportCompare(expect, actual, summary + ': 4');