michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call(true)'), true); michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call("")'), true); michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call({})'), true); michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call(null)'), true); michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call([])'), true); michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call(undefined)'), true); michael@0: assertEq(raisesException(TypeError)('Number.prototype.toString.call(new Boolean(true))'), true); michael@0: michael@0: assertEq(completesNormally('Number.prototype.toString.call(42)'), true); michael@0: assertEq(completesNormally('Number.prototype.toString.call(new Number(42))'), true); michael@0: michael@0: function testAround(middle) michael@0: { michael@0: var range = 260; michael@0: var low = middle - range/2; michael@0: for (var i = 0; i < range; ++i) michael@0: assertEq(low + i, parseInt(String(low + i))); michael@0: } michael@0: michael@0: testAround(-Math.pow(2,32)); michael@0: testAround(-Math.pow(2,16)); michael@0: testAround(0); michael@0: testAround(+Math.pow(2,16)); michael@0: testAround(+Math.pow(2,32)); michael@0: michael@0: reportCompare(true, true);