var threw = false;
try { [].reduce(function (a, b) { return a + b; }); } catch (e) { threw = e instanceof TypeError; }
assert.sameValue(threw, true, "reduce of empty array with no initial value throws TypeError");
var threwR = false;
try { [].reduceRight(function (a, b) { return a + b; }); } catch (e) { threwR = e instanceof TypeError; }
assert.sameValue(threwR, true, "reduceRight of empty array with no initial value throws TypeError");
assert.sameValue([].reduce(function (a, b) { return a + b; }, 99), 99, "empty reduce with seed returns the seed");
assert.sameValue([].reduceRight(function (a, b) { return a + b; }, 7), 7, "empty reduceRight with seed");
var calls = 0;
assert.sameValue([42].reduce(function (a, b) { calls++; return a + b; }), 42, "single element, no seed");
assert.sameValue(calls, 0, "callback not called for a single element with no seed");
assert.sameValue([1, 2, 3, 4].reduce(function (a, b) { return a + b; }), 10, "reduce sum");
assert.sameValue([1, 2, 3, 4].reduce(function (a, b) { return a + b; }, 100), 110, "reduce sum with seed");