1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
24 ECMA Section: 15.8.1.js Value Properties of the Math Object
33 Description: verify the values of some math constants
34 Author: christine@netscape.com
38 var SECTION = "15.8.1"
39 var VERSION = "ECMA_1";
41 var TITLE = "Value Properties of the Math Object";
43 writeHeaderToLog( SECTION + " "+ TITLE);
45 var testcases = getTestCases();
48 function getTestCases() {
49 var array = new Array();
52 array[item++] = new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E );
53 array[item++] = new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E );
54 array[item++] = new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 );
55 array[item++] = new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 );
56 array[item++] = new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 );
57 array[item++] = new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 );
58 array[item++] = new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E );
59 array[item++] = new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E );
60 array[item++] = new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E);
61 array[item++] = new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E);
62 array[item++] = new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI );
63 array[item++] = new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI );
64 array[item++] = new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2);
65 array[item++] = new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2);
66 array[item++] = new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 );
67 array[item++] = new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 );
69 array[item++] = new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
71 eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
77 for ( i = 0; i < testcases.length; i++ ) {
78 testcases[i].passed = writeTestCaseResult(
81 testcases[i].description +" = "+ testcases[i].actual );
82 testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value "