diff options
Diffstat (limited to 'tests/auto/qml/parserstress/tests/ecma_3/Number')
10 files changed, 752 insertions, 0 deletions
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js new file mode 100644 index 0000000000..36d63ed7e4 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Jeff Walden. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gTestfile = '15.7.4.2-01.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = "411889"; +var summary = "num.toString(), num.toString(10), and num.toString(undefined)" + + " should all be equivalent"; +var actual, expect; + +printBugNumber(BUGNUMBER); +printStatus(summary); + +/************** + * BEGIN TEST * + **************/ + +var failed = false; + +try +{ + var noargs = 3.3.toString(); + var tenarg = 3.3.toString(10); + var undefarg = 3.3.toString(undefined); + + if (noargs !== tenarg) + throw "() !== (10): " + noargs + " !== " + tenarg; + if (tenarg !== undefarg) + throw "(10) !== (undefined): " + tenarg + " !== " + undefarg; +} +catch (e) +{ + failed = e; +} + +expect = false; +actual = failed; + +reportCompare(expect, actual, summary); + +expect = 1; +actual = 3.3.toString.length; +reportCompare(expect, actual, '3.3.toString.length should be 1'); diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js new file mode 100644 index 0000000000..7c4cba753d --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Jeff Walden. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gTestfile = '15.7.4.3-01.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = "412068"; +var summary = "num.toLocaleString incorrectly accesses its first argument " + + "even when no first argument has been given"; +var actual, expect; + +printBugNumber(BUGNUMBER); +printStatus(summary); + +/************** + * BEGIN TEST * + **************/ + +var failed = false; + +try +{ + if ("3" !== 3..toLocaleString()) + throw '"3" should equal 3..toLocaleString()'; + if ("9" !== 9..toLocaleString(8)) + throw 'Number.prototype.toLocaleString should ignore its first argument'; +} +catch (e) +{ + failed = e; +} + +expect = false; +actual = failed; + +reportCompare(expect, actual, summary); diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js new file mode 100644 index 0000000000..72e7c56141 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Jeff Walden. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Philip Taylor + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gTestfile = '15.7.4.3-02.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = "446494"; +var summary = "num.toLocaleString should handle exponents"; +var actual, expect; + +printBugNumber(BUGNUMBER); +printStatus(summary); + +expect = '1e-10'; +actual = 1e-10.toLocaleString(); +reportCompare(expect, actual, summary + ': ' + expect); + +expect = 'Infinity'; +actual = Infinity.toLocaleString(); +reportCompare(expect, actual, summary + ': ' + expect); diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js new file mode 100644 index 0000000000..c21efa0b66 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * pschwartau@netscape.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Date: 2001-07-15 + * + * SUMMARY: Testing Number.prototype.toFixed(fractionDigits) + * See EMCA 262 Edition 3 Section 15.7.4.5 + * + * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 + * + */ +//----------------------------------------------------------------------------- +var gTestfile = '15.7.4.5-1.js'; +var UBound = 0; +var BUGNUMBER = '(none)'; +var summary = 'Testing Number.prototype.toFixed(fractionDigits)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 234.2040506; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toFixed(4); +expect = '234.2041'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.5 Number.prototype.toFixed(fractionDigits) + * + * An implementation is permitted to extend the behaviour of toFixed + * for values of fractionDigits less than 0 or greater than 20. In this + * case toFixed would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because fractionDigits < 0'; +actual = catchError('testNum.toFixed(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because fractionDigits > 20 '; +actual = catchError('testNum.toFixed(21)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + +status = 'Section D of test: no error intended!'; +actual = 0.00001.toFixed(2); +expect = '0.00'; +captureThis(); + +status = 'Section E of test: no error intended!'; +actual = 0.000000000000000000001.toFixed(20); +expect = '0.00000000000000000000'; +captureThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js new file mode 100644 index 0000000000..dec9ed6a90 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * pschwartau@netscape.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Date: 2001-07-15 + * + * SUMMARY: Testing Number.prototype.toExponential(fractionDigits) + * See EMCA 262 Edition 3 Section 15.7.4.6 + * + * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 + * + */ +//----------------------------------------------------------------------------- +var gTestfile = '15.7.4.6-1.js'; +var UBound = 0; +var BUGNUMBER = '(none)'; +var summary = 'Testing Number.prototype.toExponential(fractionDigits)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 77.1234; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toExponential(4); +expect = '7.7123e+1'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.6 Number.prototype.toExponential(fractionDigits) + * + * An implementation is permitted to extend the behaviour of toExponential + * for values of fractionDigits less than 0 or greater than 20. In this + * case toExponential would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because fractionDigits < 0'; +actual = catchError('testNum.toExponential(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because fractionDigits > 20 '; +actual = catchError('testNum.toExponential(21)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js new file mode 100644 index 0000000000..5aa0724a46 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * pschwartau@netscape.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Date: 2001-07-15 + * + * SUMMARY: Testing Number.prototype.toPrecision(precision) + * See EMCA 262 Edition 3 Section 15.7.4.7 + * + * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 + * + */ +//----------------------------------------------------------------------------- +var gTestfile = '15.7.4.7-1.js'; +var UBound = 0; +var BUGNUMBER = '(none)'; +var summary = 'Testing Number.prototype.toPrecision(precision)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 5.123456; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toPrecision(4); +expect = '5.123'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.7 Number.prototype.toPrecision(precision) + * + * An implementation is permitted to extend the behaviour of toPrecision + * for values of precision less than 1 or greater than 21. In this + * case toPrecision would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because precision < 1'; +actual = catchError('testNum.toPrecision(0)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because precision < 1'; +actual = catchError('testNum.toPrecision(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section D of test: expect RangeError because precision > 21 '; +actual = catchError('testNum.toPrecision(22)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js new file mode 100644 index 0000000000..5c8ff396e4 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Jeff Walden. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gTestfile = '15.7.4.7-2.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = "411893"; +var summary = "num.toPrecision(undefined) should equal num.toString()"; +var actual, expect; + +printBugNumber(BUGNUMBER); +printStatus(summary); + +/************** + * BEGIN TEST * + **************/ + +var failed = false; + +try +{ + var prec = 3.3.toPrecision(undefined); + var str = 3.3.toString(); + if (prec !== str) + { + throw "not equal! " + + "3.3.toPrecision(undefined) === '" + prec + "', " + + "3.3.toString() === '" + str + "'"; + } +} +catch (e) +{ + failed = e; +} + +expect = false; +actual = failed; + +reportCompare(expect, actual, summary); diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js new file mode 100755 index 0000000000..e3fa070e5a --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Igor Bukanov + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gTestfile = 'regress-442242-01.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = 442242; +var summary = 'Do not assert: INT_FITS_IN_JSVAL(i)'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var i = 28800000; + -i; + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js new file mode 100644 index 0000000000..03cca1d551 --- /dev/null +++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js @@ -0,0 +1 @@ +gTestsubsuite = 'Number'; |