diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:52 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:30:52 -0800 |
commit | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (patch) | |
tree | 11425ea0b299d6fb89c6d3618a22d97d5bf68d0f /JavaScriptCore/tests/mozilla/ecma/Boolean | |
parent | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (diff) | |
download | external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.zip external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.gz external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'JavaScriptCore/tests/mozilla/ecma/Boolean')
22 files changed, 1737 insertions, 0 deletions
diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js new file mode 100644 index 0000000..762b06d --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.1.js @@ -0,0 +1,96 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.1.js + ECMA Section: 15.6.1 The Boolean Function + 15.6.1.1 Boolean( value ) + 15.6.1.2 Boolean () + Description: Boolean( value ) should return a Boolean value + not a Boolean object) computed by + Boolean.toBooleanValue( value) + + 15.6.1.2 Boolean() returns false + + Author: christine@netscape.com + Date: 27 jun 1997 + + + Data File Fields: + VALUE Argument passed to the Boolean function + TYPE typeof VALUE (not used, but helpful in understanding + the data file) + E_RETURN Expected return value of Boolean( VALUE ) +*/ + var SECTION = "15.6.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); + array[item++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); + array[item++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); + array[item++] = new TestCase( SECTION, "Boolean('1')", true, Boolean("1") ); + array[item++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); + array[item++] = new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") ); + array[item++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); + array[item++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); + + array[item++] = new TestCase( SECTION, "Boolean('true')", true, Boolean("true") ); + array[item++] = new TestCase( SECTION, "Boolean('false')", true, Boolean("false") ); + array[item++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); + + array[item++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) ); + array[item++] = new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) ); + array[item++] = new TestCase( SECTION, "Boolean()", false, Boolean() ); +// array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js new file mode 100644 index 0000000..2d4e142 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.2.js @@ -0,0 +1,160 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.2.js + ECMA Section: 15.6.2 The Boolean Constructor + 15.6.2.1 new Boolean( value ) + 15.6.2.2 new Boolean() + + This test verifies that the Boolean constructor + initializes a new object (typeof should return + "object"). The prototype of the new object should + be Boolean.prototype. The value of the object + should be ToBoolean( value ) (a boolean value). + + Description: + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) ); + array[item++] = new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) ); + array[item++] = new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) ); + array[item++] = new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) ); + array[item++] = new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') ); + array[item++] = new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') ); + array[item++] = new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') ); + array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) ); + array[item++] = new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) ); + array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); + array[item++] = new TestCase( SECTION, + "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); + array[item++] = new TestCase( "15.6.2.2", + "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", + "[object Boolean]", + eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); + array[item++] = new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() ); + array[item++] = new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() ); + + return ( array ); +} + +function test() { + for ( tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js new file mode 100644 index 0000000..c3897e4 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-1.js + ECMA Section: 15.6.3 Boolean.prototype + + Description: The initial value of Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the DontEnum property of Boolean.prototype + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "var str='';for ( p in Boolean ) { str += p } str;", + "", + eval("var str='';for ( p in Boolean ) { str += p } str;") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js new file mode 100644 index 0000000..0ff248a --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-2.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-2.js + ECMA Section: 15.6.3.1 Boolean.prototype + + Description: The initial valu eof Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the DontDelete property of Boolean.prototype + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "delete( Boolean.prototype)", + false, + delete( Boolean.prototype) ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js new file mode 100644 index 0000000..5ba5c95 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-3.js @@ -0,0 +1,69 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-3.js + ECMA Section: 15.6.3.1 Boolean.prototype + + Description: The initial valu eof Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the DontDelete property of Boolean.prototype + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3.1-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "delete( Boolean.prototype); Boolean.prototype", + Boolean.prototype, + eval("delete( Boolean.prototype); Boolean.prototype") ); + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js new file mode 100644 index 0000000..56972e8 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-4.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-4.js + ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object + + Description: The initial value of Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + This tests the ReadOnly property of Boolean.prototype + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + var SECTION = "15.6.3.1-4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var BOOL_PROTO = Boolean.prototype; + + array[item++] = new TestCase( SECTION, + "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO", + true, + eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") ); + + array[item++] = new TestCase( SECTION, + "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null", + false, + eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") ); + + return ( array ); +} + + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js new file mode 100644 index 0000000..fb3605c --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1-5.js @@ -0,0 +1,61 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1-5.js + ECMA Section: 15.6.3.1 Boolean.prototype + Description: + Author: christine@netscape.com + Date: 28 october 1997 + +*/ + var VERSION = "ECMA_2"; + startTest(); + var SECTION = "15.6.3.1-5"; + var TITLE = "Boolean.prototype" + + writeHeaderToLog( SECTION + " " + TITLE ); + var tc= 0; + var testcases = getTestCases(); + +// all tests must call a function that returns an array of TestCase objects. + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js new file mode 100644 index 0000000..55614f5 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.1.js @@ -0,0 +1,72 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.1.js + ECMA Section: 15.6.3.1 Boolean.prototype + + Description: The initial valu eof Boolean.prototype is the built-in + Boolean prototype object (15.6.4). + + The property shall have the attributes [DontEnum, + DontDelete, ReadOnly ]. + + It has the internal [[Call]] and [[Construct]] + properties (not tested), and the length property. + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + + var SECTION = "15.6.3.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); + array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js new file mode 100644 index 0000000..0e9a252 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.3.js + ECMA Section: 15.6.3 Properties of the Boolean Constructor + + Description: The value of the internal prototype property is + the Function prototype object. + + It has the internal [[Call]] and [[Construct]] + properties, and the length property. + + Author: christine@netscape.com + Date: june 27, 1997 + +*/ + var SECTION = "15.6.3"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "Properties of the Boolean Constructor" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype ); + array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js new file mode 100644 index 0000000..e40d71a --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-1.js @@ -0,0 +1,73 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4-1.js + ECMA Section: 15.6.4 Properties of the Boolean Prototype Object + + Description: + The Boolean prototype object is itself a Boolean object (its [[Class]] is + "Boolean") whose value is false. + + The value of the internal [[Prototype]] property of the Boolean prototype object + is the Object prototype object (15.2.3.1). + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + + + var VERSION = "ECMA_1" + startTest(); + var SECTION = "15.6.4-1"; + + writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) ); + array[item++] = new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) ); + array[item++] = new TestCase( SECTION, + "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", + "[object Boolean]", + eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); + array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); + + return ( array ); +} + +function test() { + for (tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js new file mode 100644 index 0000000..760272e --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4-2.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4-2.js + ECMA Section: 15.6.4 Properties of the Boolean Prototype Object + + Description: + The Boolean prototype object is itself a Boolean object (its [[Class]] is + "Boolean") whose value is false. + + The value of the internal [[Prototype]] property of the Boolean prototype object + is the Object prototype object (15.2.3.1). + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + + + var VERSION = "ECMA_2" + startTest(); + var SECTION = "15.6.4-2"; + + writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); + + return ( array ); +} + +function test() { + for (tc = 0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js new file mode 100644 index 0000000..848b1f4 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.1.js @@ -0,0 +1,65 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.1.js + ECMA Section: 15.6.4.1 Boolean.prototype.constructor + + Description: The initial value of Boolean.prototype.constructor + is the built-in Boolean constructor. + + Author: christine@netscape.com + Date: 30 september 1997 + +*/ + var SECTION = "15.6.4.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.constructor" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "( Boolean.prototype.constructor == Boolean )", + true , + (Boolean.prototype.constructor == Boolean) ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js new file mode 100644 index 0000000..85514fd --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-1.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2.js + ECMA Section: 15.6.4.2-1 Boolean.prototype.toString() + Description: If this boolean value is true, then the string "true" + is returned; otherwise this boolean value must be false, + and the string "false" is returned. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() ); + + array[item++] = new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() ); + + array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() ); + array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} +function MyObject( value ) { + this.value = value; + this.valueOf = new Function( "return this.value" ); + return this; +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js new file mode 100644 index 0000000..d46c49b --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-2.js @@ -0,0 +1,79 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2-2.js + ECMA Section: 15.6.4.2 Boolean.prototype.toString() + Description: Returns this boolean value. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()", + "false", + "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" ); + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()", + "true", + "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()" ); + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()", + "false", + "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" ); + return ( array ); + +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js new file mode 100644 index 0000000..faf0a94 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-3.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2-3.js + ECMA Section: 15.6.4.2 Boolean.prototype.toString() + Description: Returns this boolean value. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + + var SECTION = "15.6.4.2-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()" + writeHeaderToLog( SECTION + TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") ); + array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") ); + + return ( array ); +} +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js new file mode 100644 index 0000000..a86ba51 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.2-4-n.js @@ -0,0 +1,70 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.2-4.js + ECMA Section: 15.6.4.2 Boolean.prototype.toString() + Description: Returns this boolean value. + + The toString function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.2-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.toString()"; + writeHeaderToLog( SECTION +" "+ TITLE ); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()", + "error", + "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval(testcases[tc].actual); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js new file mode 100644 index 0000000..3589197 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-1.js @@ -0,0 +1,91 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() ); + + array[item++] = new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() ); + + array[item++] = new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() ); + + array[item++] = new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); + array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); + + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js new file mode 100644 index 0000000..f1bc83d --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-2.js @@ -0,0 +1,67 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3-2.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") ); + array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js new file mode 100644 index 0000000..f19c168 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-3.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3-3.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + + var SECTION = "15.6.4.3-3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()", + true, + eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +}
\ No newline at end of file diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js new file mode 100644 index 0000000..fe7b17c --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3-4-n.js @@ -0,0 +1,71 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3-4.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + var SECTION = "15.6.4.3-4-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Boolean.prototype.valueOf()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, + "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()", + "error", + "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()" ); + return ( array ); +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].actual = eval( testcases[tc].actual ); + + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js new file mode 100644 index 0000000..67b9a1b --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.3.js @@ -0,0 +1,97 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.3.js + ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() + Description: Returns this boolean value. + + The valueOf function is not generic; it generates + a runtime error if its this value is not a Boolean + object. Therefore it cannot be transferred to other + kinds of objects for use as a method. + + Author: christine@netscape.com + Date: june 27, 1997 +*/ + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() ); + + array[item++] = new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() ); + + array[item++] = new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() ); + + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); + array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); + + return ( array ); +} + +function test( array ) { + var passed = true; + + writeHeaderToLog("15.8.6.4.3 Properties of the Boolean Object: valueOf"); + + for ( i = 0; i < array.length; i++ ) { + + array[i].passed = writeTestCaseResult( + array[i].expect, + array[i].actual, + "( "+ array[i].description +" ).valueOf() = "+ array[i].actual ); + + array[i].reason += ( array[i].passed ) ? "" : "wrong value "; + + passed = ( array[i].passed ) ? passed : false; + + } + + stopTest(); + + // all tests must return a boolean value + return ( array ); +} + +// for TCMS, the testcases array must be global. + var testcases = getTestCases(); + +// all tests must call a function that returns a boolean value + test( testcases ); diff --git a/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js new file mode 100644 index 0000000..44d12c1 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Boolean/15.6.4.js @@ -0,0 +1,77 @@ +/* The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Communicator client code, released March + * 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ +/** + File Name: 15.6.4.js + ECMA Section: Properties of the Boolean Prototype Object + Description: + The Boolean prototype object is itself a Boolean object (its [[Class]] is " + Boolean") whose value is false. + + The value of the internal [[Prototype]] property of the Boolean prototype + object is the Object prototype object (15.2.3.1). + + In following descriptions of functions that are properties of the Boolean + prototype object, the phrase "this Boolean object" refers to the object that + is the this value for the invocation of the function; it is an error if + this does not refer to an object for which the value of the internal + [[Class]] property is "Boolean". Also, the phrase "this boolean value" + refers to the boolean value represented by this Boolean object, that is, + the value of the internal [[Value]] property of this Boolean object. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + + var SECTION = "15.6.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Properties of the Boolean Prototype Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = new Array(); + + testcases[tc++] = new TestCase( SECTION, + "Boolean.prototype == false", + true, + Boolean.prototype == false ); + + testcases[tc++] = new TestCase( SECTION, + "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", + "[object Boolean]", + eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); + + test(); + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ + testcases[tc].actual ); + + testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; + } + stopTest(); + return ( testcases ); +} |