diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/ecma/Number | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma/Number')
38 files changed, 1395 insertions, 0 deletions
diff --git a/js/src/tests/ecma/Number/0x-without-following-hexdigits.js b/js/src/tests/ecma/Number/0x-without-following-hexdigits.js new file mode 100644 index 000000000..ffb329e5c --- /dev/null +++ b/js/src/tests/ecma/Number/0x-without-following-hexdigits.js @@ -0,0 +1,30 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 582643; +var summary = "'0x' not followed by hex digits should be a syntax error"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +try +{ + eval("0x"); + throw new Error("didn't throw parsing 0x (with no subsequent hex digits)"); +} +catch (e) +{ + assertEq(e instanceof SyntaxError, true, + "bad exception thrown: " + e); +} + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("All tests passed!"); diff --git a/js/src/tests/ecma/Number/15.7.1.js b/js/src/tests/ecma/Number/15.7.1.js new file mode 100644 index 000000000..a1a7069de --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.1.js @@ -0,0 +1,54 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.1.js + ECMA Section: 15.7.1 The Number Constructor Called as a Function + 15.7.1.1 + 15.7.1.2 + + Description: When Number is called as a function rather than as a + constructor, it performs a type conversion. + 15.7.1.1 Return a number value (not a Number object) + computed by ToNumber( value ) + 15.7.1.2 Number() returns 0. + + need to add more test cases. see the testcases for + TypeConversion ToNumber. + + Author: christine@netscape.com + Date: 29 september 1997 +*/ + +var SECTION = "15.7.1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "The Number Constructor Called as a Function"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase(SECTION, "Number()", 0, Number() ); +new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); +new TestCase(SECTION, "Number(null)", 0, Number(null) ); +new TestCase(SECTION, "Number()", 0, Number() ); +new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) ); +new TestCase(SECTION, "Number(0)", 0, Number(0) ); +new TestCase(SECTION, "Number(1)", 1, Number(1) ); +new TestCase(SECTION, "Number(-1)", -1, Number(-1) ); +new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) ); +new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") ); +new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) ); +new TestCase(SECTION, "Number('')", 0, Number( "" ) ); +new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") ); + +new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) ); + +test(); + +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); +} diff --git a/js/src/tests/ecma/Number/15.7.2.js b/js/src/tests/ecma/Number/15.7.2.js new file mode 100644 index 000000000..4be91d5ae --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.2.js @@ -0,0 +1,134 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.2.js + ECMA Section: 15.7.2 The Number Constructor + 15.7.2.1 + 15.7.2.2 + + Description: 15.7.2 When Number is called as part of a new + expression, it is a constructor: it initializes + the newly created object. + + 15.7.2.1 The [[Prototype]] property of the newly + constructed object is set to othe original Number + prototype object, the one that is the initial value + of Number.prototype(0). The [[Class]] property is + set to "Number". The [[Value]] property of the + newly constructed object is set to ToNumber(value) + + 15.7.2.2 new Number(). same as in 15.7.2.1, except + the [[Value]] property is set to +0. + + need to add more test cases. see the testcases for + TypeConversion ToNumber. + + Author: christine@netscape.com + Date: 29 september 1997 +*/ + +var SECTION = "15.7.2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "The Number Constructor"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +// To verify that the object's prototype is the Number.prototype, check to see if the object's +// constructor property is the same as Number.prototype.constructor. + +new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); + +new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); +new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor ); +new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) ); +new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor ); +new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) ); +new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor ); +new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) ); +new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor ); +new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) ); +new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor ); +new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) ); +new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor ); +new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) ); +new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor ); +new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) ); +new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor ); +new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) ); +new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor ); +new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) ); +new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + + +new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); +new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); +new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); +new TestCase(SECTION, + "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", + "[object Number]", + eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.1-1.js b/js/src/tests/ecma/Number/15.7.3.1-1.js new file mode 100644 index 000000000..7a1249d4d --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.1-1.js @@ -0,0 +1,37 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.1-2.js + ECMA Section: 15.7.3.1 Number.prototype + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.prototype + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.1-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.prototype"; + +writeHeaderToLog( SECTION +" "+ TITLE); + +new TestCase(SECTION, + "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype", + true, + eval("var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype") ); + +new TestCase(SECTION, + "delete( Number.prototype )", + false, + eval("delete( Number.prototype )") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.1-2.js b/js/src/tests/ecma/Number/15.7.3.1-2.js new file mode 100644 index 000000000..51e53a04f --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.1-2.js @@ -0,0 +1,37 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.1-2.js + ECMA Section: 15.7.3.1 Number.prototype + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.prototype + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.1-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.prototype"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, + "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT", + true, + eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") ); + +new TestCase( SECTION, + "Number.prototype=0; Number.prototype", + Number.prototype, + eval("Number.prototype=0; Number.prototype") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.1-3.js b/js/src/tests/ecma/Number/15.7.3.1-3.js new file mode 100644 index 000000000..97d890386 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.1-3.js @@ -0,0 +1,33 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.1-4.js + ECMA Section: 15.7.3.1 Number.prototype + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.prototype + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var VERSION = "ECMA_1"; +startTest(); +var SECTION = "15.7.3.1-3"; +var TITLE = "Number.prototype"; + +writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute"); + +new TestCase( + SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;") + ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.2-1.js b/js/src/tests/ecma/Number/15.7.3.2-1.js new file mode 100644 index 000000000..f4fe0e227 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.2-1.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.2-1.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.2-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MAX_VALUE"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, + "Number.MAX_VALUE", + 1.7976931348623157e308, + Number.MAX_VALUE ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.2-2.js b/js/src/tests/ecma/Number/15.7.3.2-2.js new file mode 100644 index 000000000..64caa6b6f --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.2-2.js @@ -0,0 +1,36 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.2-2.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.2-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MAX_VALUE: DontDelete Attribute"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, + "delete( Number.MAX_VALUE ); Number.MAX_VALUE", + 1.7976931348623157e308, + eval("delete( Number.MAX_VALUE );Number.MAX_VALUE") ); + +new TestCase( SECTION, + "delete( Number.MAX_VALUE )", + false, + eval("delete( Number.MAX_VALUE )") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.2-3.js b/js/src/tests/ecma/Number/15.7.3.2-3.js new file mode 100644 index 000000000..48a32a3e7 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.2-3.js @@ -0,0 +1,33 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.2-3.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.2-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MAX_VALUE"; + +writeHeaderToLog( SECTION + " "+ TITLE ); + +var MAX_VAL = 1.7976931348623157e308; + +new TestCase( SECTION, + "Number.MAX_VALUE=0; Number.MAX_VALUE", + MAX_VAL, + eval("Number.MAX_VALUE=0; Number.MAX_VALUE") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.2-4.js b/js/src/tests/ecma/Number/15.7.3.2-4.js new file mode 100644 index 000000000..96bc7071f --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.2-4.js @@ -0,0 +1,30 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.2-4.js + ECMA Section: 15.7.3.2 Number.MAX_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.MAX_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.3.2-4"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MAX_VALUE: DontEnum Attribute"; +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;") + ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.3-1.js b/js/src/tests/ecma/Number/15.7.3.3-1.js new file mode 100644 index 000000000..b71fd3db9 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.3-1.js @@ -0,0 +1,34 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.3-1.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.3-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MIN_VALUE"; + +writeHeaderToLog( SECTION + " "+ TITLE ); + +var MIN_VAL = 5e-324; + +new TestCase( SECTION, + "Number.MIN_VALUE", + MIN_VAL, + Number.MIN_VALUE ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.3-2.js b/js/src/tests/ecma/Number/15.7.3.3-2.js new file mode 100644 index 000000000..345f70492 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.3-2.js @@ -0,0 +1,39 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.3-2.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.3-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MIN_VALUE"; + +writeHeaderToLog( SECTION + " "+ TITLE ); + +var MIN_VAL = 5e-324; + +new TestCase( SECTION, + "delete( Number.MIN_VALUE )", + false, + eval("delete( Number.MIN_VALUE )") ); + +new TestCase( SECTION, + "delete( Number.MIN_VALUE ); Number.MIN_VALUE", + MIN_VAL, + eval("delete( Number.MIN_VALUE );Number.MIN_VALUE") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.3-3.js b/js/src/tests/ecma/Number/15.7.3.3-3.js new file mode 100644 index 000000000..67cbae26a --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.3-3.js @@ -0,0 +1,30 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.3-3.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.3.3-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.MIN_VALUE: ReadOnly Attribute"; + +writeHeaderToLog( SECTION + " "+TITLE ); + +new TestCase( SECTION, + "Number.MIN_VALUE=0; Number.MIN_VALUE", + Number.MIN_VALUE, + eval("Number.MIN_VALUE=0; Number.MIN_VALUE" )); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.3-4.js b/js/src/tests/ecma/Number/15.7.3.3-4.js new file mode 100644 index 000000000..13d57bc51 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.3-4.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.3-4.js + ECMA Section: 15.7.3.3 Number.MIN_VALUE + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.MIN_VALUE + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.3-4"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute"); + +new TestCase( SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;") + ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.4-1.js b/js/src/tests/ecma/Number/15.7.3.4-1.js new file mode 100644 index 000000000..c811c05e1 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.4-1.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.4-1.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.4-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NaN"; + +writeHeaderToLog( SECTION + " "+ TITLE ); + +new TestCase(SECTION, + "NaN", + NaN, + Number.NaN ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.4-2.js b/js/src/tests/ecma/Number/15.7.3.4-2.js new file mode 100644 index 000000000..3ce2e5ed4 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.4-2.js @@ -0,0 +1,37 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.4-2.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.3.4-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NaN"; + +writeHeaderToLog( SECTION + " "+ TITLE ); + +new TestCase(SECTION, + "delete( Number.NaN ); Number.NaN", + NaN, + eval("delete( Number.NaN );Number.NaN" )); + +new TestCase( SECTION, + "delete( Number.NaN )", + false, + eval("delete( Number.NaN )") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.4-3.js b/js/src/tests/ecma/Number/15.7.3.4-3.js new file mode 100644 index 000000000..f01506ac7 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.4-3.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.4-3.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.4-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NaN"; + +writeHeaderToLog( SECTION + " "+ TITLE ); + +new TestCase( SECTION, + "Number.NaN=0; Number.NaN", + Number.NaN, + eval("Number.NaN=0; Number.NaN") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.4-4.js b/js/src/tests/ecma/Number/15.7.3.4-4.js new file mode 100644 index 000000000..e650b2b55 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.4-4.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.4-4.js + ECMA Section: 15.7.3.4 Number.NaN + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.NaN + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.4-4"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NaN"; + +writeHeaderToLog( SECTION + " " + TITLE); + +new TestCase( SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;") + ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.5-1.js b/js/src/tests/ecma/Number/15.7.3.5-1.js new file mode 100644 index 000000000..27ab946ac --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.5-1.js @@ -0,0 +1,30 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.5-1.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.3.5-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NEGATIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase(SECTION, + "Number.NEGATIVE_INFINITY", + -Infinity, + Number.NEGATIVE_INFINITY ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.5-2.js b/js/src/tests/ecma/Number/15.7.3.5-2.js new file mode 100644 index 000000000..be2ba3964 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.5-2.js @@ -0,0 +1,36 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.5-2.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.5-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NEGATIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "delete( Number.NEGATIVE_INFINITY )", + false, + eval("delete( Number.NEGATIVE_INFINITY )") ); + +new TestCase( SECTION, + "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY", + -Infinity, + eval("delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.5-3.js b/js/src/tests/ecma/Number/15.7.3.5-3.js new file mode 100644 index 000000000..cb2b271a7 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.5-3.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.5-3.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.5-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NEGATIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY", + -Infinity, + eval("Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.5-4.js b/js/src/tests/ecma/Number/15.7.3.5-4.js new file mode 100644 index 000000000..d44b0f64b --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.5-4.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.5-4.js + ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.5-4"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.NEGATIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;") + ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.6-1.js b/js/src/tests/ecma/Number/15.7.3.6-1.js new file mode 100644 index 000000000..2c9f4990e --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.6-1.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.6-1.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the value of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.6-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.POSITIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "Number.POSITIVE_INFINITY", + Infinity, + Number.POSITIVE_INFINITY ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.6-2.js b/js/src/tests/ecma/Number/15.7.3.6-2.js new file mode 100644 index 000000000..55553adb3 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.6-2.js @@ -0,0 +1,35 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.6-2.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.3.6-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.POSITIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase(SECTION, + "delete( Number.POSITIVE_INFINITY )", + false, + eval("delete( Number.POSITIVE_INFINITY )") ); + +new TestCase(SECTION, + "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY", + Infinity, + eval("delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.6-3.js b/js/src/tests/ecma/Number/15.7.3.6-3.js new file mode 100644 index 000000000..b08b4a96c --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.6-3.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.6-3.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "15.7.3.6-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.POSITIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY", + Number.POSITIVE_INFINITY, + eval("Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.6-4.js b/js/src/tests/ecma/Number/15.7.3.6-4.js new file mode 100644 index 000000000..79250d9eb --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.6-4.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.6-4.js + ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY + Description: All value properties of the Number object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontEnum attribute of Number.POSITIVE_INFINITY + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.3.6-4"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.POSITIVE_INFINITY"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;", + "", + eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;") + ); + + +test(); diff --git a/js/src/tests/ecma/Number/15.7.3.js b/js/src/tests/ecma/Number/15.7.3.js new file mode 100644 index 000000000..9ac4c4b18 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.3.js @@ -0,0 +1,35 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.3.js + 15.7.3 Properties of the Number Constructor + + Description: The value of the internal [[Prototype]] property + of the Number constructor is the Function prototype + object. The Number constructor also has the internal + [[Call]] and [[Construct]] properties, and the length + property. + + Other properties are in subsequent tests. + + Author: christine@netscape.com + Date: 29 september 1997 +*/ + +var SECTION = "15.7.3"; +var VERSION = "ECMA_2"; +startTest(); +var TITLE = "Properties of the Number Constructor"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase(SECTION, + "Number.length", + 1, + Number.length ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4-1.js b/js/src/tests/ecma/Number/15.7.4-1.js new file mode 100644 index 000000000..05d16a5c2 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4-1.js @@ -0,0 +1,26 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4-1.js + ECMA Section: 15.7.4.1 Properties of the Number Prototype Object + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + +var SECTION = "15.7.4-1"; +var VERSION = "ECMA_1"; +startTest(); +writeHeaderToLog( SECTION + "Properties of the Number prototype object"); + +new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); +new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) ); +new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number ); +// new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.1.js b/js/src/tests/ecma/Number/15.7.4.1.js new file mode 100644 index 000000000..da8c20501 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.1.js @@ -0,0 +1,28 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.1.js + ECMA Section: 15.7.4.1.1 Number.prototype.constructor + + Number.prototype.constructor is the built-in Number constructor. + + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Number.prototype.constructor"; + +writeHeaderToLog( SECTION + " "+TITLE); + +new TestCase( SECTION, + "Number.prototype.constructor", + Number, + Number.prototype.constructor ); +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.2-1.js b/js/src/tests/ecma/Number/15.7.4.2-1.js new file mode 100644 index 000000000..05939a6e6 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.2-1.js @@ -0,0 +1,77 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.2.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.2-1"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.prototype.toString()"); + +// the following two lines cause navigator to crash -- cmb 9/16/97 +new TestCase(SECTION, + "Number.prototype.toString()", + "0", + eval("Number.prototype.toString()") ); + +new TestCase(SECTION, + "typeof(Number.prototype.toString())", + "string", + eval("typeof(Number.prototype.toString())") ); + +new TestCase(SECTION, + "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()", + "0", + eval("s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()") ); + +new TestCase(SECTION, + "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()", + "1", + eval("s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()") ); + +new TestCase(SECTION, + "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()", + "-1", + eval("s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()") ); + +new TestCase(SECTION, + "var MYNUM = new Number(255); MYNUM.toString(10)", + "255", + eval("var MYNUM = new Number(255); MYNUM.toString(10)") ); + +new TestCase(SECTION, + "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)", + "NaN", + eval("var MYNUM = new Number(Number.NaN); MYNUM.toString(10)") ); + +new TestCase(SECTION, + "var MYNUM = new Number(Infinity); MYNUM.toString(10)", + "Infinity", + eval("var MYNUM = new Number(Infinity); MYNUM.toString(10)") ); + +new TestCase(SECTION, + "var MYNUM = new Number(-Infinity); MYNUM.toString(10)", + "-Infinity", + eval("var MYNUM = new Number(-Infinity); MYNUM.toString(10)") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.2-2-n.js b/js/src/tests/ecma/Number/15.7.4.2-2-n.js new file mode 100644 index 000000000..83eef466d --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.2-2-n.js @@ -0,0 +1,42 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.2-2-n.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.2-2-n"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.prototype.toString()"); + +DESCRIPTION = "o = new Object(); o.toString = Number.prototype.toString; o.toString()"; +EXPECTED = "error"; + +new TestCase(SECTION, + "o = new Object(); o.toString = Number.prototype.toString; o.toString()", + "error", + eval("o = new Object(); o.toString = Number.prototype.toString; o.toString()") ); + +// new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") ); +// new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.2-3-n.js b/js/src/tests/ecma/Number/15.7.4.2-3-n.js new file mode 100644 index 000000000..adaf443e5 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.2-3-n.js @@ -0,0 +1,39 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.2-3-n.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.2-3-n"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.prototype.toString()"); + +DESCRIPTION = "o = new String(); o.toString = Number.prototype.toString; o.toString()"; +EXPECTED = "error"; + +new TestCase(SECTION, + "o = new String(); o.toString = Number.prototype.toString; o.toString()", + "error", + eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.2-4.js b/js/src/tests/ecma/Number/15.7.4.2-4.js new file mode 100644 index 000000000..9eaee4d60 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.2-4.js @@ -0,0 +1,36 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.2-4.js + ECMA Section: 15.7.4.2.1 Number.prototype.toString() + Description: + If the radix is the number 10 or not supplied, then this number value is + given as an argument to the ToString operator; the resulting string value + is returned. + + If the radix is supplied and is an integer from 2 to 36, but not 10, the + result is a string, the choice of which is implementation dependent. + + The toString function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.2-4"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.prototype.toString()"); + +new TestCase(SECTION, + "o = 3; o.toString = Number.prototype.toString; o.toString()", + "3", + eval("o = 3; o.toString = Number.prototype.toString; o.toString()") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.3-1.js b/js/src/tests/ecma/Number/15.7.4.3-1.js new file mode 100644 index 000000000..04d5e125d --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.3-1.js @@ -0,0 +1,63 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.3-1.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.3-1"; +var VERSION = "ECMA_1"; +startTest(); + + +writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + +// the following two line causes navigator to crash -- cmb 9/16/97 +new TestCase("SECTION", + "Number.prototype.valueOf()", + 0, + eval("Number.prototype.valueOf()") ); + +new TestCase("SECTION", + "(new Number(1)).valueOf()", + 1, + eval("(new Number(1)).valueOf()") ); + +new TestCase("SECTION", + "(new Number(-1)).valueOf()", + -1, + eval("(new Number(-1)).valueOf()") ); + +new TestCase("SECTION", + "(new Number(0)).valueOf()", + 0, + eval("(new Number(0)).valueOf()") ); + +new TestCase("SECTION", + "(new Number(Number.POSITIVE_INFINITY)).valueOf()", + Number.POSITIVE_INFINITY, + eval("(new Number(Number.POSITIVE_INFINITY)).valueOf()") ); + +new TestCase("SECTION", + "(new Number(Number.NaN)).valueOf()", + Number.NaN, + eval("(new Number(Number.NaN)).valueOf()") ); + +new TestCase("SECTION", + "(new Number()).valueOf()", + 0, + eval("(new Number()).valueOf()") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.3-2.js b/js/src/tests/ecma/Number/15.7.4.3-2.js new file mode 100644 index 000000000..4af1a2fc1 --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.3-2.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.3-2.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.3-2"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + +new TestCase(SECTION, + "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", + 3, + eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") ); + +test(); diff --git a/js/src/tests/ecma/Number/15.7.4.3-3-n.js b/js/src/tests/ecma/Number/15.7.4.3-3-n.js new file mode 100644 index 000000000..ded89575d --- /dev/null +++ b/js/src/tests/ecma/Number/15.7.4.3-3-n.js @@ -0,0 +1,38 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 15.7.4.3-3.js + ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() + Description: + Returns this number value. + + The valueOf function is not generic; it generates a runtime error if its + this value is not a Number object. Therefore it cannot be transferred to + other kinds of objects for use as a method. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "15.7.4.3-3-n"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); + +// new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") ); + +DESCRIPTION = "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()"; +EXPECTED = "error"; + +new TestCase("15.7.4.1", + "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()", + "error", + eval("v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()") ); + +// new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()") ); + +test(); diff --git a/js/src/tests/ecma/Number/browser.js b/js/src/tests/ecma/Number/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/ecma/Number/browser.js diff --git a/js/src/tests/ecma/Number/shell.js b/js/src/tests/ecma/Number/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/ecma/Number/shell.js |