diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch) | |
tree | d49911209b132da58d838efa852daf28d516df21 /JavaScriptCore/tests/mozilla/ecma/Math | |
parent | 87eb0cb35bad8784770ebc807e6c982432e47107 (diff) | |
download | external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2 |
Initial Contribution
Diffstat (limited to 'JavaScriptCore/tests/mozilla/ecma/Math')
39 files changed, 3186 insertions, 0 deletions
diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js new file mode 100644 index 0000000..8b08eb6 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8-1.js @@ -0,0 +1,84 @@ +/* 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.8-1.js + ECMA Section: 15.8 The Math Object + + Description: + + The Math object is merely a single object that has some named properties, + some of which are functions. + + The value of the internal [[Prototype]] property of the Math object is the + Object prototype object (15.2.3.1). + + The Math object does not have a [[Construct]] property; it is not possible + to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] property; it is not possible to + invoke the Math object as a function. + + Recall that, in this specification, the phrase "the number value for x" has + a technical meaning defined in section 8.5. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + + var SECTION = "15.8-1"; + var VERSION = "ECMA_2"; + startTest(); + var TITLE = "The Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "Math.__proto__ == Object.prototype", + true, + Math.__proto__ == Object.prototype ); + + array[item++] = new TestCase( SECTION, + "Math.__proto__", + Object.prototype, + Math.__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/Math/15.8-2-n.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js new file mode 100644 index 0000000..2bf41c0 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8-2-n.js @@ -0,0 +1,83 @@ +/* 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.8-2.js + ECMA Section: 15.8 The Math Object + + Description: + + The Math object is merely a single object that has some named properties, + some of which are functions. + + The value of the internal [[Prototype]] property of the Math object is the + Object prototype object (15.2.3.1). + + The Math object does not have a [[Construct]] property; it is not possible + to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] property; it is not possible to + invoke the Math object as a function. + + Recall that, in this specification, the phrase "the number value for x" has + a technical meaning defined in section 8.5. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + + var SECTION = "15.8-2-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "MYMATH = new Math()", + "error", + "MYMATH = new Math()" ); + + 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 += "Math does not have the [Construct] property"; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js new file mode 100644 index 0000000..4896f48 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8-3-n.js @@ -0,0 +1,81 @@ +/* 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.8-3.js + ECMA Section: 15.8 The Math Object + + Description: + + The Math object is merely a single object that has some named properties, + some of which are functions. + + The value of the internal [[Prototype]] property of the Math object is the + Object prototype object (15.2.3.1). + + The Math object does not have a [[Construct]] property; it is not possible + to use the Math object as a constructor with the new operator. + + The Math object does not have a [[Call]] property; it is not possible to + invoke the Math object as a function. + + Recall that, in this specification, the phrase "the number value for x" has + a technical meaning defined in section 8.5. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ + var SECTION = "15.8-3-n"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "The Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, + "MYMATH = Math()", + "error", + "MYMATH = Math()" ); + + 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 += "Math does not have the [Call] property"; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js new file mode 100644 index 0000000..f22fdca --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-1.js @@ -0,0 +1,62 @@ +/* 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.8.1.1-1.js + ECMA Section: 15.8.1.1.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.1-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.E = 0; Math.E", 2.7182818284590452354, ("Math.E=0;Math.E") ); + 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 ) ? "" : "Math.E should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.js new file mode 100644 index 0000000..2aea4ff --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.1-2.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.8.1.1-2.js + ECMA Section: 15.8.1.1.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.1-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MATH_E = 2.7182818284590452354 + array[item++] = new TestCase( SECTION, "delete(Math.E)", false, "delete Math.E" ); + array[item++] = new TestCase( SECTION, "delete(Math.E); Math.E", MATH_E, "delete Math.E; Math.E" ); + 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 ) ? "" : "should not be able to delete property"; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js new file mode 100644 index 0000000..a9d8c0d --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-1.js @@ -0,0 +1,62 @@ +/* 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.8.1.2-1.js + ECMA Section: 15.8.2.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LN10 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.2-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN10"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.LN10=0; Math.LN10", 2.302585092994046, "Math.LN10=0; Math.LN10" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js new file mode 100644 index 0000000..2774177 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.2-2.js @@ -0,0 +1,63 @@ +/* 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.8.1.2-1.js + ECMA Section: 15.8.2.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LN10 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.2-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN10"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); Math.LN10", 2.302585092994046, "delete(Math.LN10); Math.LN10" ); + array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); ", false, "delete(Math.LN10)" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js new file mode 100644 index 0000000..d8354ad --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-1.js @@ -0,0 +1,63 @@ +/* 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.8.1.3-1.js + ECMA Section: 15.8.1.3.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LN2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.3-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.LN2=0; Math.LN2", 0.6931471805599453, ("Math.LN2=0; Math.LN2") ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-2.js new file mode 100644 index 0000000..a26ef79 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.3-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.8.1.3-3.js + ECMA Section: 15.8.1.3.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LN2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.3-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LN2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + var MATH_LN2 = 0.6931471805599453; + + array[item++] = new TestCase( SECTION, "delete(Math.LN2)", false, "delete(Math.LN2)" ); + array[item++] = new TestCase( SECTION, "delete(Math.LN2); Math.LN2", MATH_LN2, "delete(Math.LN2); Math.LN2" ); + + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js new file mode 100644 index 0000000..82e2fea --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-1.js @@ -0,0 +1,64 @@ +/* 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.8.1.4-1.js + ECMA Section: 15.8.1.4.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LOG2E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.4-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG2E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.L0G2E=0; Math.LOG2E", 1.4426950408889634, ("Math.LOG2E=0; Math.LOG2E") ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.js new file mode 100644 index 0000000..9208b46 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.4-2.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.8.1.4-2.js + ECMA Section: 15.8.1.4.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LOG2E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.4-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG2E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete(Math.L0G2E);Math.LOG2E", 1.4426950408889634, "delete(Math.LOG2E);Math.LOG2E" ); + array[item++] = new TestCase( SECTION, "delete(Math.L0G2E)", false, "delete(Math.LOG2E)" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.js new file mode 100644 index 0000000..1ad5000 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-1.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.8.1.5-1.js + ECMA Section: 15.8.1.5.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.LOG10E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + + var SECTION = "15.8.1.5-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG10E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.LOG10E=0; Math.LOG10E", 0.4342944819032518, ("Math.LOG10E=0; Math.LOG10E") ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js new file mode 100644 index 0000000..7b204e7 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.5-2.js @@ -0,0 +1,66 @@ +/* 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.8.1.5-2.js + ECMA Section: 15.8.1.5.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.LOG10E + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.5-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.LOG10E"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.LOG10E; Math.LOG10E", 0.4342944819032518, "delete Math.LOG10E; Math.LOG10E" ); + array[item++] = new TestCase( SECTION, "delete Math.LOG10E", false, "delete Math.LOG10E" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js new file mode 100644 index 0000000..4a998cc --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-1.js @@ -0,0 +1,63 @@ +/* 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.8.1.6-1.js + ECMA Section: 15.8.1.6.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.PI + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.6-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.PI"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.PI=0; Math.PI", 3.1415926535897923846, "Math.PI=0; Math.PI" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js new file mode 100644 index 0000000..3a0fb1f --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.6-2.js @@ -0,0 +1,64 @@ +/* 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.8.1.6-2.js + ECMA Section: 15.8.1.6.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.PI + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.6-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.PI"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", 3.1415926535897923846, "delete Math.PI; Math.PI" ); + array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", false, "delete Math.PI" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js new file mode 100644 index 0000000..9eeb6d7 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-1.js @@ -0,0 +1,64 @@ +/* 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.8.1.7-1.js + ECMA Section: 15.8.1.7.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.SQRT1_2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.7-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT1_2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.SQRT1_2=0; Math.SQRT1_2", 0.7071067811865476, "Math.SQRT1_2=0; Math.SQRT1_2" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js new file mode 100644 index 0000000..85dd054 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.7-2.js @@ -0,0 +1,64 @@ +/* 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.8.1.7-2.js + ECMA Section: 15.8.1.7.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.SQRT1_2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.7-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT1_2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2; Math.SQRT1_2", 0.7071067811865476, "delete Math.SQRT1_2; Math.SQRT1_2" ); + array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2", false, "delete Math.SQRT1_2" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js new file mode 100644 index 0000000..1b3615d --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-1.js @@ -0,0 +1,64 @@ +/* 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.8.1.8-1.js + ECMA Section: 15.8.1.8.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the ReadOnly attribute of Math.SQRT2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.1.8-1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "Math.SQRT2=0; Math.SQRT2", 1.4142135623730951, ("Math.SQRT2=0; Math.SQRT2") ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js new file mode 100644 index 0000000..25634dd --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-2.js @@ -0,0 +1,63 @@ +/* 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.8.1.8-2.js + ECMA Section: 15.8.1.8.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.SQRT2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.8-2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.SQRT2"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.SQRT2; Math.SQRT2", 1.4142135623730951, "delete Math.SQRT2; Math.SQRT2" ); + array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, "delete Math.SQRT2" ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.js new file mode 100644 index 0000000..d1df188 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.8-3.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.8.1.8-3.js + ECMA Section: 15.8.1.8.js + Description: All value properties of the Math object should have + the attributes [DontEnum, DontDelete, ReadOnly] + + this test checks the DontDelete attribute of Math.SQRT2 + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + var SECTION = "15.8.1.8-3"; + var VERSION = "ECMA_1"; + startTest(); + var testcases = getTestCases(); + + writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete"); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, ("delete Math.SQRT2") ); + 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 ) ? "" : "property should be read-only "; + } + stopTest(); + return ( testcases ); +} + diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js new file mode 100644 index 0000000..a0fdf26 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.1.js @@ -0,0 +1,86 @@ +/* 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.8.1.js + ECMA Section: 15.8.1.js Value Properties of the Math Object + 15.8.1.1 E + 15.8.1.2 LN10 + 15.8.1.3 LN2 + 15.8.1.4 LOG2E + 15.8.1.5 LOG10E + 15.8.1.6 PI + 15.8.1.7 SQRT1_2 + 15.8.1.8 SQRT2 + Description: verify the values of some math constants + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.1" + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Value Properties of the Math Object"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E ); + array[item++] = new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E ); + array[item++] = new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 ); + array[item++] = new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 ); + array[item++] = new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 ); + array[item++] = new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 ); + array[item++] = new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E ); + array[item++] = new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E ); + array[item++] = new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E); + array[item++] = new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E); + array[item++] = new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI ); + array[item++] = new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI ); + array[item++] = new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2); + array[item++] = new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2); + array[item++] = new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 ); + array[item++] = new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 ); + + array[item++] = new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS", + "", + eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") ); + + return ( array ); +} + +function test() { + for ( i = 0; i < testcases.length; i++ ) { + testcases[i].passed = writeTestCaseResult( + testcases[i].expect, + testcases[i].actual, + testcases[i].description +" = "+ testcases[i].actual ); + testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value " + } + stopTest(); + return ( testcases ); +} diff --git a/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js new file mode 100644 index 0000000..4f0ba21 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.1.js @@ -0,0 +1,103 @@ +/* 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.8.2.1.js + ECMA Section: 15.8.2.1 abs( x ) + Description: return the absolute value of the argument, + which should be the magnitude of the argument + with a positive sign. + - if x is NaN, return NaN + - if x is -0, result is +0 + - if x is -Infinity, result is +Infinity + Author: christine@netscape.com + Date: 7 july 1997 +*/ + var SECTION = "15.8.2.1"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.abs()"; + var BUGNUMBER = "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.abs.length", 1, Math.abs.length ); + + array[item++] = new TestCase( SECTION, "Math.abs()", Number.NaN, Math.abs() ); + array[item++] = new TestCase( SECTION, "Math.abs( void 0 )", Number.NaN, Math.abs(void 0) ); + array[item++] = new TestCase( SECTION, "Math.abs( null )", 0, Math.abs(null) ); + array[item++] = new TestCase( SECTION, "Math.abs( true )", 1, Math.abs(true) ); + array[item++] = new TestCase( SECTION, "Math.abs( false )", 0, Math.abs(false) ); + array[item++] = new TestCase( SECTION, "Math.abs( string primitive)", Number.NaN, Math.abs("a string primitive") ); + array[item++] = new TestCase( SECTION, "Math.abs( string object )", Number.NaN, Math.abs(new String( 'a String object' )) ); + array[item++] = new TestCase( SECTION, "Math.abs( Number.NaN )", Number.NaN, Math.abs(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.abs(0)", 0, Math.abs( 0 ) ); + array[item++] = new TestCase( SECTION, "Math.abs( -0 )", 0, Math.abs(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.abs(-0)", Infinity, Infinity/Math.abs(-0) ); + + array[item++] = new TestCase( SECTION, "Math.abs( -Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.NEGATIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "Math.abs( Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.POSITIVE_INFINITY ) ); + array[item++] = new TestCase( SECTION, "Math.abs( - MAX_VALUE )", Number.MAX_VALUE, Math.abs( - Number.MAX_VALUE ) ); + array[item++] = new TestCase( SECTION, "Math.abs( - MIN_VALUE )", Number.MIN_VALUE, Math.abs( -Number.MIN_VALUE ) ); + array[item++] = new TestCase( SECTION, "Math.abs( MAX_VALUE )", Number.MAX_VALUE, Math.abs( Number.MAX_VALUE ) ); + array[item++] = new TestCase( SECTION, "Math.abs( MIN_VALUE )", Number.MIN_VALUE, Math.abs( Number.MIN_VALUE ) ); + + array[item++] = new TestCase( SECTION, "Math.abs( -1 )", 1, Math.abs( -1 ) ); + array[item++] = new TestCase( SECTION, "Math.abs( new Number( -1 ) )", 1, Math.abs( new Number(-1) ) ); + array[item++] = new TestCase( SECTION, "Math.abs( 1 )", 1, Math.abs( 1 ) ); + array[item++] = new TestCase( SECTION, "Math.abs( Math.PI )", Math.PI, Math.abs( Math.PI ) ); + array[item++] = new TestCase( SECTION, "Math.abs( -Math.PI )", Math.PI, Math.abs( -Math.PI ) ); + array[item++] = new TestCase( SECTION, "Math.abs(-1/100000000)", 1/100000000, Math.abs(-1/100000000) ); + array[item++] = new TestCase( SECTION, "Math.abs(-Math.pow(2,32))", Math.pow(2,32), Math.abs(-Math.pow(2,32)) ); + array[item++] = new TestCase( SECTION, "Math.abs(Math.pow(2,32))", Math.pow(2,32), Math.abs(Math.pow(2,32)) ); + array[item++] = new TestCase( SECTION, "Math.abs( -0xfff )", 4095, Math.abs( -0xfff ) ); + array[item++] = new TestCase( SECTION, "Math.abs( -0777 )", 511, Math.abs(-0777 ) ); + + array[item++] = new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') ); + array[item++] = new TestCase( SECTION, "Math.abs('0xff')", 255, Math.abs('0xff') ); + array[item++] = new TestCase( SECTION, "Math.abs('077')", 77, Math.abs('077') ); + array[item++] = new TestCase( SECTION, "Math.abs( 'Infinity' )", Infinity, Math.abs('Infinity') ); + array[item++] = new TestCase( SECTION, "Math.abs( '-Infinity' )", Infinity, Math.abs('-Infinity') ); + + 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/Math/15.8.2.10.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js new file mode 100644 index 0000000..24b6cb8 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.10.js @@ -0,0 +1,86 @@ +/* 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.8.2.10.js + ECMA Section: 15.8.2.10 Math.log(x) + Description: return an approximiation to the natural logarithm of + the argument. + special cases: + - if arg is NaN result is NaN + - if arg is <0 result is NaN + - if arg is 0 or -0 result is -Infinity + - if arg is 1 result is 0 + - if arg is Infinity result is Infinity + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.10"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.log(x)"; + var BUGNUMBER = "77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.log.length", 1, Math.log.length ); + + array[item++] = new TestCase( SECTION, "Math.log()", Number.NaN, Math.log() ); + array[item++] = new TestCase( SECTION, "Math.log(void 0)", Number.NaN, Math.log(void 0) ); + array[item++] = new TestCase( SECTION, "Math.log(null)", Number.NEGATIVE_INFINITY, Math.log(null) ); + array[item++] = new TestCase( SECTION, "Math.log(true)", 0, Math.log(true) ); + array[item++] = new TestCase( SECTION, "Math.log(false)", -Infinity, Math.log(false) ); + array[item++] = new TestCase( SECTION, "Math.log('0')", -Infinity, Math.log('0') ); + array[item++] = new TestCase( SECTION, "Math.log('1')", 0, Math.log('1') ); + array[item++] = new TestCase( SECTION, "Math.log('Infinity')", Infinity, Math.log("Infinity") ); + + array[item++] = new TestCase( SECTION, "Math.log(NaN)", Number.NaN, Math.log(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.log(-0.0000001)", Number.NaN, Math.log(-0.000001) ); + array[item++] = new TestCase( SECTION, "Math.log(-1)", Number.NaN, Math.log(-1) ); + array[item++] = new TestCase( SECTION, "Math.log(0)", Number.NEGATIVE_INFINITY, Math.log(0) ); + array[item++] = new TestCase( SECTION, "Math.log(-0)", Number.NEGATIVE_INFINITY, Math.log(-0)); + array[item++] = new TestCase( SECTION, "Math.log(1)", 0, Math.log(1) ); + array[item++] = new TestCase( SECTION, "Math.log(Infinity)", Number.POSITIVE_INFINITY, Math.log(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.log(-Infinity)", Number.NaN, Math.log(Number.NEGATIVE_INFINITY) ); + + 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/Math/15.8.2.11.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js new file mode 100644 index 0000000..4be499c --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.11.js @@ -0,0 +1,98 @@ +/* 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.8.2.11.js + ECMA Section: 15.8.2.11 Math.max(x, y) + Description: return the smaller of the two arguments. + special cases: + - if x is NaN or y is NaN return NaN + - if x < y return x + - if y > x return y + - if x is +0 and y is +0 return +0 + - if x is +0 and y is -0 return -0 + - if x is -0 and y is +0 return -0 + - if x is -0 and y is -0 return -0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.11"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.max(x, y)"; + var BUGNUMBER="76439"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.max.length", 2, Math.max.length ); + + array[item++] = new TestCase( SECTION, "Math.max()", -Infinity, Math.max() ); + array[item++] = new TestCase( SECTION, "Math.max(void 0, 1)", Number.NaN, Math.max( void 0, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.max(void 0, void 0)", Number.NaN, Math.max( void 0, void 0 ) ); + array[item++] = new TestCase( SECTION, "Math.max(null, 1)", 1, Math.max( null, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.max(-1, null)", 0, Math.max( -1, null ) ); + array[item++] = new TestCase( SECTION, "Math.max(true, false)", 1, Math.max(true,false) ); + + array[item++] = new TestCase( SECTION, "Math.max('-99','99')", 99, Math.max( "-99","99") ); + + array[item++] = new TestCase( SECTION, "Math.max(NaN, Infinity)", Number.NaN, Math.max(Number.NaN,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(NaN, 0)", Number.NaN, Math.max(Number.NaN, 0) ); + array[item++] = new TestCase( SECTION, "Math.max('a string', 0)", Number.NaN, Math.max("a string", 0) ); + array[item++] = new TestCase( SECTION, "Math.max(NaN, 1)", Number.NaN, Math.max(Number.NaN,1) ); + array[item++] = new TestCase( SECTION, "Math.max('a string',Infinity)", Number.NaN, Math.max("a string", Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(Infinity, NaN)", Number.NaN, Math.max( Number.POSITIVE_INFINITY, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(NaN, NaN)", Number.NaN, Math.max(Number.NaN, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(0,NaN)", Number.NaN, Math.max(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(1, NaN)", Number.NaN, Math.max(1, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.max(0,0)", 0, Math.max(0,0) ); + array[item++] = new TestCase( SECTION, "Math.max(0,-0)", 0, Math.max(0,-0) ); + array[item++] = new TestCase( SECTION, "Math.max(-0,0)", 0, Math.max(-0,0) ); + array[item++] = new TestCase( SECTION, "Math.max(-0,-0)", -0, Math.max(-0,-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.max(-0,-0)", -Infinity, Infinity/Math.max(-0,-0) ); + array[item++] = new TestCase( SECTION, "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) ); + array[item++] = new TestCase( SECTION, "Math.max(Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(-Infinity,-Infinity)", Number.NEGATIVE_INFINITY, Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.max(1,.99999999999999)", 1, Math.max(1,.99999999999999) ); + array[item++] = new TestCase( SECTION, "Math.max(-1,-.99999999999999)", -.99999999999999, Math.max(-1,-.99999999999999) ); + + 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/Math/15.8.2.12.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.js new file mode 100644 index 0000000..0706e0b --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.12.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.8.2.12.js + ECMA Section: 15.8.2.12 Math.min(x, y) + Description: return the smaller of the two arguments. + special cases: + - if x is NaN or y is NaN return NaN + - if x < y return x + - if y > x return y + - if x is +0 and y is +0 return +0 + - if x is +0 and y is -0 return -0 + - if x is -0 and y is +0 return -0 + - if x is -0 and y is -0 return -0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + + var SECTION = "15.8.2.12"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.min(x, y)"; + var BUGNUMBER="76439"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.min.length", 2, Math.min.length ); + + array[item++] = new TestCase( SECTION, "Math.min()", Infinity, Math.min() ); + array[item++] = new TestCase( SECTION, "Math.min(void 0, 1)", Number.NaN, Math.min( void 0, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.min(void 0, void 0)", Number.NaN, Math.min( void 0, void 0 ) ); + array[item++] = new TestCase( SECTION, "Math.min(null, 1)", 0, Math.min( null, 1 ) ); + array[item++] = new TestCase( SECTION, "Math.min(-1, null)", -1, Math.min( -1, null ) ); + array[item++] = new TestCase( SECTION, "Math.min(true, false)", 0, Math.min(true,false) ); + + array[item++] = new TestCase( SECTION, "Math.min('-99','99')", -99, Math.min( "-99","99") ); + + array[item++] = new TestCase( SECTION, "Math.min(NaN,0)", Number.NaN, Math.min(Number.NaN,0) ); + array[item++] = new TestCase( SECTION, "Math.min(NaN,1)", Number.NaN, Math.min(Number.NaN,1) ); + array[item++] = new TestCase( SECTION, "Math.min(NaN,-1)", Number.NaN, Math.min(Number.NaN,-1) ); + array[item++] = new TestCase( SECTION, "Math.min(0,NaN)", Number.NaN, Math.min(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(1,NaN)", Number.NaN, Math.min(1,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(-1,NaN)", Number.NaN, Math.min(-1,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(NaN,NaN)", Number.NaN, Math.min(Number.NaN,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.min(1,1.0000000001)", 1, Math.min(1,1.0000000001) ); + array[item++] = new TestCase( SECTION, "Math.min(1.0000000001,1)", 1, Math.min(1.0000000001,1) ); + array[item++] = new TestCase( SECTION, "Math.min(0,0)", 0, Math.min(0,0) ); + array[item++] = new TestCase( SECTION, "Math.min(0,-0)", -0, Math.min(0,-0) ); + array[item++] = new TestCase( SECTION, "Math.min(-0,-0)", -0, Math.min(-0,-0) ); + + array[item++] = new TestCase( SECTION, "Infinity/Math.min(0,-0)", -Infinity, Infinity/Math.min(0,-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.min(-0,-0)", -Infinity, Infinity/Math.min(-0,-0) ); + + + 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/Math/15.8.2.13.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js new file mode 100644 index 0000000..4744eb0 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.13.js @@ -0,0 +1,132 @@ +/* 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.8.2.13.js + ECMA Section: 15.8.2.13 Math.pow(x, y) + Description: return an approximation to the result of x + to the power of y. there are many special cases; + refer to the spec. + Author: christine@netscape.com + Date: 9 july 1997 +*/ + + var SECTION = "15.8.2.13"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.pow(x, y)"; + var BUGNUMBER="77141"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.pow.length", 2, Math.pow.length ); + + array[item++] = new TestCase( SECTION, "Math.pow()", Number.NaN, Math.pow() ); + array[item++] = new TestCase( SECTION, "Math.pow(null, null)", 1, Math.pow(null,null) ); + array[item++] = new TestCase( SECTION, "Math.pow(void 0, void 0)", Number.NaN, Math.pow(void 0, void 0)); + array[item++] = new TestCase( SECTION, "Math.pow(true, false)", 1, Math.pow(true, false) ); + array[item++] = new TestCase( SECTION, "Math.pow(false,true)", 0, Math.pow(false,true) ); + array[item++] = new TestCase( SECTION, "Math.pow('2','32')", 4294967296, Math.pow('2','32') ); + + array[item++] = new TestCase( SECTION, "Math.pow(1,NaN)", Number.NaN, Math.pow(1,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.pow(0,NaN)", Number.NaN, Math.pow(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,0)", 1, Math.pow(Number.NaN,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,-0)", 1, Math.pow(Number.NaN,-0) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,1)", Number.NaN, Math.pow(Number.NaN, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(NaN,.5)", Number.NaN, Math.pow(Number.NaN, .5) ); + array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(1.00000001, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, -Infinity)", 0, Math.pow(1.00000001, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(-1.00000001,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, -Infinity)", 0, Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(1, Infinity)", Number.NaN, Math.pow(1, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(1, -Infinity)", Number.NaN, Math.pow(1, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, Infinity)", Number.NaN, Math.pow(-1, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, -Infinity)", Number.NaN, Math.pow(-1, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, Infinity)", 0, Math.pow(.0000000009, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-.0000000009, Infinity)", 0, Math.pow(-.0000000009, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, .00000000001)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY,.00000000001) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 1)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -.00000000001)",0, Math.pow(Number.POSITIVE_INFINITY, -.00000000001) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -1)", 0, Math.pow(Number.POSITIVE_INFINITY, -1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 1)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 333)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 333) ); + array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 2)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 666)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 666) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 0.5)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -1)", -0, Math.pow(Number.NEGATIVE_INFINITY, -1) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-Infinity, -1)", -Infinity, Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) ); + + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -3)", -0, Math.pow(Number.NEGATIVE_INFINITY, -3) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -2)", 0, Math.pow(Number.NEGATIVE_INFINITY, -2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -0.5)", 0, Math.pow(Number.NEGATIVE_INFINITY,-0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -Infinity)", 0, Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 1)", 0, Math.pow(0,1) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 0)", 1, Math.pow(0,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(1, 0)", 1, Math.pow(1,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, 0)", 1, Math.pow(-1,0) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 0.5)", 0, Math.pow(0,0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, 1000)", 0, Math.pow(0,1000) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, Infinity)", 0, Math.pow(0, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -1)", Number.POSITIVE_INFINITY, Math.pow(0, -1) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -0.5)", Number.POSITIVE_INFINITY, Math.pow(0, -0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -1000)", Number.POSITIVE_INFINITY, Math.pow(0, -1000) ); + array[item++] = new TestCase( SECTION, "Math.pow(0, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(0, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, 1)", -0, Math.pow(-0, 1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, 3)", -0, Math.pow(-0,3) ); + + array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 1)", -Infinity, Infinity/Math.pow(-0, 1) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 3)", -Infinity, Infinity/Math.pow(-0,3) ); + + array[item++] = new TestCase( SECTION, "Math.pow(-0, 2)", 0, Math.pow(-0,2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, -1)", Number.NEGATIVE_INFINITY, Math.pow(-0, -1) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, -10001)", Number.NEGATIVE_INFINITY, Math.pow(-0, -10001) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, -2)", Number.POSITIVE_INFINITY, Math.pow(-0, -2) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, 0.5)", 0, Math.pow(-0, 0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, 0.5)", Number.NaN, Math.pow(-1, 0.5) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, NaN)", Number.NaN, Math.pow(-1, Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.pow(-1, -0.5)", Number.NaN, Math.pow(-1, -0.5) ); + + 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/Math/15.8.2.14.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js new file mode 100644 index 0000000..e5ed1fb --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.14.js @@ -0,0 +1,83 @@ +/* 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.8.2.14.js + ECMA Section: 15.8.2.14 Math.random() + returns a number value x with a positive sign + with 1 > x >= 0 with approximately uniform + distribution over that range, using an + implementation-dependent algorithm or strategy. + This function takes no arguments. + + Description: + Author: christine@netscape.com + Date: 16 september 1997 +*/ + + var SECTION = "15.8.2.14"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.random()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + + +function getTestCases() { + var array = new Array(); + var item = 0; + + for ( item = 0; item < 100; item++ ) { + array[item] = new TestCase( SECTION, "Math.random()", "pass", null ); + } + + return ( array ); +} +function getRandom( caseno ) { + testcases[caseno].reason = Math.random(); + testcases[caseno].actual = "pass"; + + if ( ! ( testcases[caseno].reason >= 0) ) { + testcases[caseno].actual = "fail"; + } + + if ( ! (testcases[caseno].reason < 1) ) { + testcases[caseno].actual = "fail"; + } +} + +function test() { + for ( tc=0; tc < testcases.length; tc++ ) { + getRandom( 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/Math/15.8.2.15.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js new file mode 100644 index 0000000..ca8cc94 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.15.js @@ -0,0 +1,113 @@ +/* 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.8.2.15.js + ECMA Section: 15.8.2.15 Math.round(x) + Description: return the greatest number value that is closest to the + argument and is an integer. if two integers are equally + close to the argument. then the result is the number value + that is closer to Infinity. if the argument is an integer, + return the argument. + special cases: + - if x is NaN return NaN + - if x = +0 return +0 + - if x = -0 return -0 + - if x = Infinity return Infinity + - if x = -Infinity return -Infinity + - if 0 < x < 0.5 return 0 + - if -0.5 <= x < 0 return -0 + example: + Math.round( 3.5 ) == 4 + Math.round( -3.5 ) == 3 + also: + - Math.round(x) == Math.floor( x + 0.5 ) + except if x = -0. in that case, Math.round(x) = -0 + + and Math.floor( x+0.5 ) = +0 + + + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.15"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.round(x)"; + var BUGNUMBER="331411"; + + var EXCLUDE = "true"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.round.length", 1, Math.round.length ); + + array[item++] = new TestCase( SECTION, "Math.round()", Number.NaN, Math.round() ); + array[item++] = new TestCase( SECTION, "Math.round(null)", 0, Math.round(0) ); + array[item++] = new TestCase( SECTION, "Math.round(void 0)", Number.NaN, Math.round(void 0) ); + array[item++] = new TestCase( SECTION, "Math.round(true)", 1, Math.round(true) ); + array[item++] = new TestCase( SECTION, "Math.round(false)", 0, Math.round(false) ); + array[item++] = new TestCase( SECTION, "Math.round('.99999')", 1, Math.round('.99999') ); + array[item++] = new TestCase( SECTION, "Math.round('12345e-2')", 123, Math.round('12345e-2') ); + + array[item++] = new TestCase( SECTION, "Math.round(NaN)", Number.NaN, Math.round(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.round(0)", 0, Math.round(0) ); + array[item++] = new TestCase( SECTION, "Math.round(-0)", -0, Math.round(-0)); + array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0)", -Infinity, Infinity/Math.round(-0) ); + + array[item++] = new TestCase( SECTION, "Math.round(Infinity)", Number.POSITIVE_INFINITY, Math.round(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.round(-Infinity)",Number.NEGATIVE_INFINITY, Math.round(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.round(0.49)", 0, Math.round(0.49)); + array[item++] = new TestCase( SECTION, "Math.round(0.5)", 1, Math.round(0.5)); + array[item++] = new TestCase( SECTION, "Math.round(0.51)", 1, Math.round(0.51)); + + array[item++] = new TestCase( SECTION, "Math.round(-0.49)", -0, Math.round(-0.49)); + array[item++] = new TestCase( SECTION, "Math.round(-0.5)", -0, Math.round(-0.5)); + array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.49)", -Infinity, Infinity/Math.round(-0.49)); + array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.5)", -Infinity, Infinity/Math.round(-0.5)); + + array[item++] = new TestCase( SECTION, "Math.round(-0.51)", -1, Math.round(-0.51)); + array[item++] = new TestCase( SECTION, "Math.round(3.5)", 4, Math.round(3.5)); + array[item++] = new TestCase( SECTION, "Math.round(-3.5)", -3, Math.round(-3)); + + 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/Math/15.8.2.16.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js new file mode 100644 index 0000000..b144d9b --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.16.js @@ -0,0 +1,78 @@ +/* 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.8.2.16.js + ECMA Section: 15.8.2.16 sin( x ) + Description: return an approximation to the sine of the + argument. argument is expressed in radians + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.2.16"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.sin(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length ); + + array[item++] = new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() ); + array[item++] = new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) ); + array[item++] = new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) ); + array[item++] = new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) ); + array[item++] = new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') ); + + array[item++] = new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) ); + array[item++] = new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0)); + array[item++] = new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974)); + array[item++] = new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795)); + array[item++] = new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192)); + array[item++] = new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359)); + + 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/Math/15.8.2.17.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js new file mode 100644 index 0000000..16859ed --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.17.js @@ -0,0 +1,99 @@ +/* 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.8.2.17.js + ECMA Section: 15.8.2.17 Math.sqrt(x) + Description: return an approximation to the squareroot of the argument. + special cases: + - if x is NaN return NaN + - if x < 0 return NaN + - if x == 0 return 0 + - if x == -0 return -0 + - if x == Infinity return Infinity + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.17"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.sqrt(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.sqrt.length", 1, Math.sqrt.length ); + + array[item++] = new TestCase( SECTION, "Math.sqrt()", Number.NaN, Math.sqrt() ); + array[item++] = new TestCase( SECTION, "Math.sqrt(void 0)", Number.NaN, Math.sqrt(void 0) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(null)", 0, Math.sqrt(null) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(true)", 1, Math.sqrt(1) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(false)", 0, Math.sqrt(false) ); + array[item++] = new TestCase( SECTION, "Math.sqrt('225')", 15, Math.sqrt('225') ); + + array[item++] = new TestCase( SECTION, "Math.sqrt(NaN)", Number.NaN, Math.sqrt(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(-Infinity)", Number.NaN, Math.sqrt(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sqrt(-1)", Number.NaN, Math.sqrt(-1)); + array[item++] = new TestCase( SECTION, "Math.sqrt(-0.5)", Number.NaN, Math.sqrt(-0.5)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0)", 0, Math.sqrt(0)); + array[item++] = new TestCase( SECTION, "Math.sqrt(-0)", -0, Math.sqrt(-0)); + array[item++] = new TestCase( SECTION, "Infinity/Math.sqrt(-0)", -Infinity, Infinity/Math.sqrt(-0) ); + array[item++] = new TestCase( SECTION, "Math.sqrt(Infinity)", Number.POSITIVE_INFINITY, Math.sqrt(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.sqrt(1)", 1, Math.sqrt(1)); + array[item++] = new TestCase( SECTION, "Math.sqrt(2)", Math.SQRT2, Math.sqrt(2)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.5)", Math.SQRT1_2, Math.sqrt(0.5)); + array[item++] = new TestCase( SECTION, "Math.sqrt(4)", 2, Math.sqrt(4)); + array[item++] = new TestCase( SECTION, "Math.sqrt(9)", 3, Math.sqrt(9)); + array[item++] = new TestCase( SECTION, "Math.sqrt(16)", 4, Math.sqrt(16)); + array[item++] = new TestCase( SECTION, "Math.sqrt(25)", 5, Math.sqrt(25)); + array[item++] = new TestCase( SECTION, "Math.sqrt(36)", 6, Math.sqrt(36)); + array[item++] = new TestCase( SECTION, "Math.sqrt(49)", 7, Math.sqrt(49)); + array[item++] = new TestCase( SECTION, "Math.sqrt(64)", 8, Math.sqrt(64)); + array[item++] = new TestCase( SECTION, "Math.sqrt(256)", 16, Math.sqrt(256)); + array[item++] = new TestCase( SECTION, "Math.sqrt(10000)", 100, Math.sqrt(10000)); + array[item++] = new TestCase( SECTION, "Math.sqrt(65536)", 256, Math.sqrt(65536)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.09)", 0.3, Math.sqrt(0.09)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.01)", 0.1, Math.sqrt(0.01)); + array[item++] = new TestCase( SECTION, "Math.sqrt(0.00000001)",0.0001, Math.sqrt(0.00000001)); + + 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/Math/15.8.2.18.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js new file mode 100644 index 0000000..f745dd7 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.18.js @@ -0,0 +1,98 @@ +/* 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.8.2.18.js + ECMA Section: 15.8.2.18 tan( x ) + Description: return an approximation to the tan of the + argument. argument is expressed in radians + special cases: + - if x is NaN result is NaN + - if x is 0 result is 0 + - if x is -0 result is -0 + - if x is Infinity or -Infinity result is NaN + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.18"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.tan(x)"; + var EXCLUDE = "true"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.tan.length", 1, Math.tan.length ); + + array[item++] = new TestCase( SECTION, "Math.tan()", Number.NaN, Math.tan() ); + array[item++] = new TestCase( SECTION, "Math.tan(void 0)", Number.NaN, Math.tan(void 0)); + array[item++] = new TestCase( SECTION, "Math.tan(null)", 0, Math.tan(null) ); + array[item++] = new TestCase( SECTION, "Math.tan(false)", 0, Math.tan(false) ); + + array[item++] = new TestCase( SECTION, "Math.tan(NaN)", Number.NaN, Math.tan(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.tan(0)", 0, Math.tan(0)); + array[item++] = new TestCase( SECTION, "Math.tan(-0)", -0, Math.tan(-0)); + array[item++] = new TestCase( SECTION, "Math.tan(Infinity)", Number.NaN, Math.tan(Number.POSITIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.tan(-Infinity)", Number.NaN, Math.tan(Number.NEGATIVE_INFINITY)); + array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/4)", 1, Math.tan(Math.PI/4)); + array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/4)", -1, Math.tan(3*Math.PI/4)); + array[item++] = new TestCase( SECTION, "Math.tan(Math.PI)", -0, Math.tan(Math.PI)); + array[item++] = new TestCase( SECTION, "Math.tan(5*Math.PI/4)", 1, Math.tan(5*Math.PI/4)); + array[item++] = new TestCase( SECTION, "Math.tan(7*Math.PI/4)", -1, Math.tan(7*Math.PI/4)); + array[item++] = new TestCase( SECTION, "Infinity/Math.tan(-0)", -Infinity, Infinity/Math.tan(-0) ); + +/* + Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2. + That is to say, perturbing PI/2 by this much is about the smallest rounding error possible. + + This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I + suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest + results to infinity that the algorithm can deliver. + + In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger. + = C = +*/ + array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/2) >= 5443000000000000", true, Math.tan(3*Math.PI/2) >= 5443000000000000 ); + array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/2) >= 5443000000000000", true, Math.tan(Math.PI/2) >= 5443000000000000 ); + + 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/Math/15.8.2.2.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js new file mode 100644 index 0000000..4a6f11e --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.2.js @@ -0,0 +1,86 @@ +/* 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.8.2.2.js + ECMA Section: 15.8.2.2 acos( x ) + Description: return an approximation to the arc cosine of the + argument. the result is expressed in radians and + range is from +0 to +PI. special cases: + - if x is NaN, return NaN + - if x > 1, the result is NaN + - if x < -1, the result is NaN + - if x == 1, the result is +0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + var SECTION = "15.8.2.2"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.acos()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.acos.length", 1, Math.acos.length ); + + array[item++] = new TestCase( SECTION, "Math.acos(void 0)", Number.NaN, Math.acos(void 0) ); + array[item++] = new TestCase( SECTION, "Math.acos()", Number.NaN, Math.acos() ); + array[item++] = new TestCase( SECTION, "Math.acos(null)", Math.PI/2, Math.acos(null) ); + array[item++] = new TestCase( SECTION, "Math.acos(NaN)", Number.NaN, Math.acos(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.acos(a string)", Number.NaN, Math.acos("a string") ); + array[item++] = new TestCase( SECTION, "Math.acos('0')", Math.PI/2, Math.acos('0') ); + array[item++] = new TestCase( SECTION, "Math.acos('1')", 0, Math.acos('1') ); + array[item++] = new TestCase( SECTION, "Math.acos('-1')", Math.PI, Math.acos('-1') ); + + array[item++] = new TestCase( SECTION, "Math.acos(1.00000001)", Number.NaN, Math.acos(1.00000001) ); + array[item++] = new TestCase( SECTION, "Math.acos(11.00000001)", Number.NaN, Math.acos(-1.00000001) ); + array[item++] = new TestCase( SECTION, "Math.acos(1)", 0, Math.acos(1) ); + array[item++] = new TestCase( SECTION, "Math.acos(-1)", Math.PI, Math.acos(-1) ); + array[item++] = new TestCase( SECTION, "Math.acos(0)", Math.PI/2, Math.acos(0) ); + array[item++] = new TestCase( SECTION, "Math.acos(-0)", Math.PI/2, Math.acos(-0) ); + array[item++] = new TestCase( SECTION, "Math.acos(Math.SQRT1_2)", Math.PI/4, Math.acos(Math.SQRT1_2)); + array[item++] = new TestCase( SECTION, "Math.acos(-Math.SQRT1_2)", Math.PI/4*3, Math.acos(-Math.SQRT1_2)); + array[item++] = new TestCase( SECTION, "Math.acos(0.9999619230642)", Math.PI/360, Math.acos(0.9999619230642)); + + 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/Math/15.8.2.3.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js new file mode 100644 index 0000000..2a00e93 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.3.js @@ -0,0 +1,90 @@ +/* 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.8.2.3.js + ECMA Section: 15.8.2.3 asin( x ) + Description: return an approximation to the arc sine of the + argument. the result is expressed in radians and + range is from -PI/2 to +PI/2. special cases: + - if x is NaN, the result is NaN + - if x > 1, the result is NaN + - if x < -1, the result is NaN + - if x == +0, the result is +0 + - if x == -0, the result is -0 + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.2.3"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.asin()"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.asin()", Number.NaN, Math.asin() ); + array[item++] = new TestCase( SECTION, "Math.asin(void 0)", Number.NaN, Math.asin(void 0) ); + array[item++] = new TestCase( SECTION, "Math.asin(null)", 0, Math.asin(null) ); + array[item++] = new TestCase( SECTION, "Math.asin(NaN)", Number.NaN, Math.asin(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.asin('string')", Number.NaN, Math.asin("string") ); + array[item++] = new TestCase( SECTION, "Math.asin('0')", 0, Math.asin("0") ); + array[item++] = new TestCase( SECTION, "Math.asin('1')", Math.PI/2, Math.asin("1") ); + array[item++] = new TestCase( SECTION, "Math.asin('-1')", -Math.PI/2, Math.asin("-1") ); + array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2+'')", Math.PI/4, Math.asin(Math.SQRT1_2+'') ); + array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2+'')", -Math.PI/4, Math.asin(-Math.SQRT1_2+'') ); + + array[item++] = new TestCase( SECTION, "Math.asin(1.000001)", Number.NaN, Math.asin(1.000001) ); + array[item++] = new TestCase( SECTION, "Math.asin(-1.000001)", Number.NaN, Math.asin(-1.000001) ); + array[item++] = new TestCase( SECTION, "Math.asin(0)", 0, Math.asin(0) ); + array[item++] = new TestCase( SECTION, "Math.asin(-0)", -0, Math.asin(-0) ); + + array[item++] = new TestCase( SECTION, "Infinity/Math.asin(-0)", -Infinity, Infinity/Math.asin(-0) ); + + array[item++] = new TestCase( SECTION, "Math.asin(1)", Math.PI/2, Math.asin(1) ); + array[item++] = new TestCase( SECTION, "Math.asin(-1)", -Math.PI/2, Math.asin(-1) ); + array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2))", Math.PI/4, Math.asin(Math.SQRT1_2) ); + array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2))", -Math.PI/4, Math.asin(-Math.SQRT1_2)); + + 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/Math/15.8.2.4.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js new file mode 100644 index 0000000..3711331 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.4.js @@ -0,0 +1,88 @@ +/* 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.8.2.4.js + ECMA Section: 15.8.2.4 atan( x ) + Description: return an approximation to the arc tangent of the + argument. the result is expressed in radians and + range is from -PI/2 to +PI/2. special cases: + - if x is NaN, the result is NaN + - if x == +0, the result is +0 + - if x == -0, the result is -0 + - if x == +Infinity, the result is approximately +PI/2 + - if x == -Infinity, the result is approximately -PI/2 + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + + var SECTION = "15.8.2.4"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.atan()"; + var BUGNUMBER="77391"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.atan.length", 1, Math.atan.length ); + + array[item++] = new TestCase( SECTION, "Math.atan()", Number.NaN, Math.atan() ); + array[item++] = new TestCase( SECTION, "Math.atan(void 0)", Number.NaN, Math.atan(void 0) ); + array[item++] = new TestCase( SECTION, "Math.atan(null)", 0, Math.atan(null) ); + array[item++] = new TestCase( SECTION, "Math.atan(NaN)", Number.NaN, Math.atan(Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.atan('a string')", Number.NaN, Math.atan("a string") ); + array[item++] = new TestCase( SECTION, "Math.atan('0')", 0, Math.atan('0') ); + array[item++] = new TestCase( SECTION, "Math.atan('1')", Math.PI/4, Math.atan('1') ); + array[item++] = new TestCase( SECTION, "Math.atan('-1')", -Math.PI/4, Math.atan('-1') ); + array[item++] = new TestCase( SECTION, "Math.atan('Infinity)", Math.PI/2, Math.atan('Infinity') ); + array[item++] = new TestCase( SECTION, "Math.atan('-Infinity)", -Math.PI/2, Math.atan('-Infinity') ); + + array[item++] = new TestCase( SECTION, "Math.atan(0)", 0, Math.atan(0) ); + array[item++] = new TestCase( SECTION, "Math.atan(-0)", -0, Math.atan(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.atan(-0)", -Infinity, Infinity/Math.atan(-0) ); + array[item++] = new TestCase( SECTION, "Math.atan(Infinity)", Math.PI/2, Math.atan(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan(-Infinity)", -Math.PI/2, Math.atan(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan(1)", Math.PI/4, Math.atan(1) ); + array[item++] = new TestCase( SECTION, "Math.atan(-1)", -Math.PI/4, Math.atan(-1) ); + 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/Math/15.8.2.5.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js new file mode 100644 index 0000000..d1eeead --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.5.js @@ -0,0 +1,105 @@ +/* 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.8.2.5.js + ECMA Section: 15.8.2.5 atan2( y, x ) + Description: + + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + var SECTION = "15.8.2.5"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.atan2(x,y)"; + var BUGNUMBER="76111"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.atan2.length", 2, Math.atan2.length ); + + array[item++] = new TestCase( SECTION, "Math.atan2(NaN, 0)", Number.NaN, Math.atan2(Number.NaN,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(null, null)", 0, Math.atan2(null, null) ); + array[item++] = new TestCase( SECTION, "Math.atan2(void 0, void 0)", Number.NaN, Math.atan2(void 0, void 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2()", Number.NaN, Math.atan2() ); + + array[item++] = new TestCase( SECTION, "Math.atan2(0, NaN)", Number.NaN, Math.atan2(0,Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1, 0)", Math.PI/2, Math.atan2(1,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1,-0)", Math.PI/2, Math.atan2(1,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0,0.001)", 0, Math.atan2(0,0.001) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0,0)", 0, Math.atan2(0,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0, -0)", Math.PI, Math.atan2(0,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(0, -1)", Math.PI, Math.atan2(0, -1) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-0, 1)", -0, Math.atan2(-0, 1) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-0, 1)", -Infinity, Infinity/Math.atan2(-0,1) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-0, 0)", -0, Math.atan2(-0,0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-0, -0)", -Math.PI, Math.atan2(-0, -0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-0, -1)", -Math.PI, Math.atan2(-0, -1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-1, 0)", -Math.PI/2, Math.atan2(-1, 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-1, -0)", -Math.PI/2, Math.atan2(-1, -0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1, Infinity)", 0, Math.atan2(1, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(1,-Infinity)", Math.PI, Math.atan2(1, Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-1, Infinity)", -0, Math.atan2(-1,Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-1, Infinity)", -Infinity, Infinity/Math.atan2(-1,Infinity) ); + + array[item++] = new TestCase( SECTION, "Math.atan2(-1,-Infinity)", -Math.PI, Math.atan2(-1,Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity,-0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-0) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-1) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, Infinity)", Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, -Infinity)", 3*Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, Infinity)", -Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -Infinity)", -3*Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.atan2(-1, 1)", -Math.PI/4, Math.atan2( -1, 1) ); + + 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/Math/15.8.2.6.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js new file mode 100644 index 0000000..738bfe4 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.6.js @@ -0,0 +1,108 @@ +/* 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.8.2.6.js + ECMA Section: 15.8.2.6 Math.ceil(x) + Description: return the smallest number value that is not less than the + argument and is equal to a mathematical integer. if the + number is already an integer, return the number itself. + special cases: + - if x is NaN return NaN + - if x = +0 return +0 + - if x = 0 return -0 + - if x = Infinity return Infinity + - if x = -Infinity return -Infinity + - if ( -1 < x < 0 ) return -0 + also: + - the value of Math.ceil(x) == -Math.ceil(-x) + Author: christine@netscape.com + Date: 7 july 1997 +*/ + var SECTION = "15.8.2.6"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.ceil(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.ceil.length", 1, Math.ceil.length ); + + array[item++] = new TestCase( SECTION, "Math.ceil(NaN)", Number.NaN, Math.ceil(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.ceil(null)", 0, Math.ceil(null) ); + array[item++] = new TestCase( SECTION, "Math.ceil()", Number.NaN, Math.ceil() ); + array[item++] = new TestCase( SECTION, "Math.ceil(void 0)", Number.NaN, Math.ceil(void 0) ); + + array[item++] = new TestCase( SECTION, "Math.ceil('0')", 0, Math.ceil('0') ); + array[item++] = new TestCase( SECTION, "Math.ceil('-0')", -0, Math.ceil('-0') ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('0')", Infinity, Infinity/Math.ceil('0')); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('-0')", -Infinity, Infinity/Math.ceil('-0')); + + array[item++] = new TestCase( SECTION, "Math.ceil(0)", 0, Math.ceil(0) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-0)", -0, Math.ceil(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(0)", Infinity, Infinity/Math.ceil(0)); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0)", -Infinity, Infinity/Math.ceil(-0)); + + array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", Number.POSITIVE_INFINITY, Math.ceil(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", Number.NEGATIVE_INFINITY, Math.ceil(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -0, Math.ceil(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-Number.MIN_VALUE)", -Infinity, Infinity/Math.ceil(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "Math.ceil(1)", 1, Math.ceil(1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -1, Math.ceil(-1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -0, Math.ceil(-0.9) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0.9)", -Infinity, Infinity/Math.ceil(-0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", 1, Math.ceil( 0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -1, Math.ceil( -1.1)); + array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", 2, Math.ceil( 1.1)); + + array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", -Math.floor(-Infinity), Math.ceil(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", -Math.floor(Infinity), Math.ceil(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -Math.floor(Number.MIN_VALUE), Math.ceil(-Number.MIN_VALUE) ); + array[item++] = new TestCase( SECTION, "Math.ceil(1)", -Math.floor(-1), Math.ceil(1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -Math.floor(1), Math.ceil(-1) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -Math.floor(0.9), Math.ceil(-0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", -Math.floor(-0.9), Math.ceil( 0.9) ); + array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -Math.floor(1.1), Math.ceil( -1.1)); + array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", -Math.floor(-1.1), Math.ceil( 1.1)); + + 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/Math/15.8.2.7.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js new file mode 100644 index 0000000..6b7dcfe --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.7.js @@ -0,0 +1,111 @@ +/* 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.8.2.7.js + ECMA Section: 15.8.2.7 cos( x ) + Description: return an approximation to the cosine of the + argument. argument is expressed in radians + Author: christine@netscape.com + Date: 7 july 1997 + +*/ + + var SECTION = "15.8.2.7"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.cos(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.cos.length", 1, Math.cos.length ); + + array[item++] = new TestCase( SECTION, "Math.cos()", Number.NaN, Math.cos() ); + array[item++] = new TestCase( SECTION, "Math.cos(void 0)", Number.NaN, Math.cos(void 0) ); + array[item++] = new TestCase( SECTION, "Math.cos(false)", 1, Math.cos(false) ); + array[item++] = new TestCase( SECTION, "Math.cos(null)", 1, Math.cos(null) ); + + array[item++] = new TestCase( SECTION, "Math.cos('0')", 1, Math.cos('0') ); + array[item++] = new TestCase( SECTION, "Math.cos('Infinity')", Number.NaN, Math.cos("Infinity") ); + array[item++] = new TestCase( SECTION, "Math.cos('3.14159265359')", -1, Math.cos('3.14159265359') ); + + array[item++] = new TestCase( SECTION, "Math.cos(NaN)", Number.NaN, Math.cos(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.cos(0)", 1, Math.cos(0) ); + array[item++] = new TestCase( SECTION, "Math.cos(-0)", 1, Math.cos(-0) ); + array[item++] = new TestCase( SECTION, "Math.cos(Infinity)", Number.NaN, Math.cos(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Infinity)", Number.NaN, Math.cos(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.cos(0.7853981633974)", 0.7071067811865, Math.cos(0.7853981633974) ); + array[item++] = new TestCase( SECTION, "Math.cos(1.570796326795)", 0, Math.cos(1.570796326795) ); + array[item++] = new TestCase( SECTION, "Math.cos(2.356194490192)", -0.7071067811865, Math.cos(2.356194490192) ); + array[item++] = new TestCase( SECTION, "Math.cos(3.14159265359)", -1, Math.cos(3.14159265359) ); + array[item++] = new TestCase( SECTION, "Math.cos(3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); + array[item++] = new TestCase( SECTION, "Math.cos(4.712388980385)", 0, Math.cos(4.712388980385) ); + array[item++] = new TestCase( SECTION, "Math.cos(5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(Math.PI*2) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/4)", Math.SQRT2/2, Math.cos(Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/2)", 0, Math.cos(Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/4)", -Math.SQRT2/2, Math.cos(3*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI)", -1, Math.cos(Math.PI) ); + array[item++] = new TestCase( SECTION, "Math.cos(5*Math.PI/4)", -Math.SQRT2/2, Math.cos(5*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/2)", 0, Math.cos(3*Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(7*Math.PI/4)", Math.SQRT2/2, Math.cos(7*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(2*Math.PI) ); + array[item++] = new TestCase( SECTION, "Math.cos(-0.7853981633974)", 0.7071067811865, Math.cos(-0.7853981633974) ); + array[item++] = new TestCase( SECTION, "Math.cos(-1.570796326795)", 0, Math.cos(-1.570796326795) ); + array[item++] = new TestCase( SECTION, "Math.cos(-2.3561944901920)", -.7071067811865, Math.cos(2.3561944901920) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3.14159265359)", -1, Math.cos(3.14159265359) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); + array[item++] = new TestCase( SECTION, "Math.cos(-4.712388980385)", 0, Math.cos(4.712388980385) ); + array[item++] = new TestCase( SECTION, "Math.cos(-5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); + array[item++] = new TestCase( SECTION, "Math.cos(-6.28318530718)", 1, Math.cos(6.28318530718) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/4)", Math.SQRT2/2, Math.cos(-Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/2)", 0, Math.cos(-Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/4)", -Math.SQRT2/2, Math.cos(-3*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI)", -1, Math.cos(-Math.PI) ); + array[item++] = new TestCase( SECTION, "Math.cos(-5*Math.PI/4)", -Math.SQRT2/2, Math.cos(-5*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/2)", 0, Math.cos(-3*Math.PI/2) ); + array[item++] = new TestCase( SECTION, "Math.cos(-7*Math.PI/4)", Math.SQRT2/2, Math.cos(-7*Math.PI/4) ); + array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI*2)", 1, Math.cos(-Math.PI*2) ); + + 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/Math/15.8.2.8.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js new file mode 100644 index 0000000..c0a4924 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.8.js @@ -0,0 +1,84 @@ +/* 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.8.2.8.js + ECMA Section: 15.8.2.8 Math.exp(x) + Description: return an approximation to the exponential function of + the argument (e raised to the power of the argument) + special cases: + - if x is NaN return NaN + - if x is 0 return 1 + - if x is -0 return 1 + - if x is Infinity return Infinity + - if x is -Infinity return 0 + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + + var SECTION = "15.8.2.8"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.exp(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.exp.length", 1, Math.exp.length ); + + array[item++] = new TestCase( SECTION, "Math.exp()", Number.NaN, Math.exp() ); + array[item++] = new TestCase( SECTION, "Math.exp(null)", 1, Math.exp(null) ); + array[item++] = new TestCase( SECTION, "Math.exp(void 0)", Number.NaN, Math.exp(void 0) ); + array[item++] = new TestCase( SECTION, "Math.exp(1)", Math.E, Math.exp(1) ); + array[item++] = new TestCase( SECTION, "Math.exp(true)", Math.E, Math.exp(true) ); + array[item++] = new TestCase( SECTION, "Math.exp(false)", 1, Math.exp(false) ); + + array[item++] = new TestCase( SECTION, "Math.exp('1')", Math.E, Math.exp('1') ); + array[item++] = new TestCase( SECTION, "Math.exp('0')", 1, Math.exp('0') ); + + array[item++] = new TestCase( SECTION, "Math.exp(NaN)", Number.NaN, Math.exp(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.exp(0)", 1, Math.exp(0) ); + array[item++] = new TestCase( SECTION, "Math.exp(-0)", 1, Math.exp(-0) ); + array[item++] = new TestCase( SECTION, "Math.exp(Infinity)", Number.POSITIVE_INFINITY, Math.exp(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.exp(-Infinity)", 0, Math.exp(Number.NEGATIVE_INFINITY) ); + + 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/Math/15.8.2.9.js b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js new file mode 100644 index 0000000..c1ea987 --- /dev/null +++ b/JavaScriptCore/tests/mozilla/ecma/Math/15.8.2.9.js @@ -0,0 +1,105 @@ +/* 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.8.2.9.js + ECMA Section: 15.8.2.9 Math.floor(x) + Description: return the greatest number value that is not greater + than the argument and is equal to a mathematical integer. + if the number is already an integer, return the number + itself. special cases: + - if x is NaN return NaN + - if x = +0 return +0 + - if x = -0 return -0 + - if x = Infinity return Infinity + - if x = -Infinity return -Infinity + - if ( -1 < x < 0 ) return -0 + also: + - the value of Math.floor(x) == -Math.ceil(-x) + Author: christine@netscape.com + Date: 7 july 1997 +*/ + + var SECTION = "15.8.2.9"; + var VERSION = "ECMA_1"; + startTest(); + var TITLE = "Math.floor(x)"; + + writeHeaderToLog( SECTION + " "+ TITLE); + + var testcases = getTestCases(); + test(); + +function getTestCases() { + var array = new Array(); + var item = 0; + + array[item++] = new TestCase( SECTION, "Math.floor.length", 1, Math.floor.length ); + + array[item++] = new TestCase( SECTION, "Math.floor()", Number.NaN, Math.floor() ); + array[item++] = new TestCase( SECTION, "Math.floor(void 0)", Number.NaN, Math.floor(void 0) ); + array[item++] = new TestCase( SECTION, "Math.floor(null)", 0, Math.floor(null) ); + array[item++] = new TestCase( SECTION, "Math.floor(true)", 1, Math.floor(true) ); + array[item++] = new TestCase( SECTION, "Math.floor(false)", 0, Math.floor(false) ); + + array[item++] = new TestCase( SECTION, "Math.floor('1.1')", 1, Math.floor("1.1") ); + array[item++] = new TestCase( SECTION, "Math.floor('-1.1')", -2, Math.floor("-1.1") ); + array[item++] = new TestCase( SECTION, "Math.floor('0.1')", 0, Math.floor("0.1") ); + array[item++] = new TestCase( SECTION, "Math.floor('-0.1')", -1, Math.floor("-0.1") ); + + array[item++] = new TestCase( SECTION, "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) ); + array[item++] = new TestCase( SECTION, "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) ); + + array[item++] = new TestCase( SECTION, "Math.floor(0)", 0, Math.floor(0) ); + array[item++] = new TestCase( SECTION, "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) ); + + array[item++] = new TestCase( SECTION, "Math.floor(-0)", -0, Math.floor(-0) ); + array[item++] = new TestCase( SECTION, "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) ); + array[item++] = new TestCase( SECTION, "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) ); + + array[item++] = new TestCase( SECTION, "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) ); + array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) ); + + array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)", 0, Math.floor(0.0000001) ); + array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) ); + + array[item++] = new TestCase( SECTION, "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) ); + array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) ); + + 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 |