Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / ecma / Math / 15.8.1.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is Mozilla Communicator client code, released
16  * March 31, 1998.
17  *
18  * The Initial Developer of the Original Code is
19  * Netscape Communications Corporation.
20  * Portions created by the Initial Developer are Copyright (C) 1998
21  * the Initial Developer. All Rights Reserved.
22  *
23  * Contributor(s):
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39
40 /**
41    File Name:          15.8.1.js
42    ECMA Section:       15.8.1.js   Value Properties of the Math Object
43    15.8.1.1    E
44    15.8.1.2    LN10
45    15.8.1.3    LN2
46    15.8.1.4    LOG2E
47    15.8.1.5    LOG10E
48    15.8.1.6    PI
49    15.8.1.7    SQRT1_2
50    15.8.1.8    SQRT2
51    Description:        verify the values of some math constants
52    Author:             christine@netscape.com
53    Date:               7 july 1997
54
55 */
56 var SECTION = "15.8.1"
57   var VERSION = "ECMA_1";
58 startTest();
59 var TITLE   = "Value Properties of the Math Object";
60
61 writeHeaderToLog( SECTION + " "+ TITLE);
62
63
64 new TestCase( "15.8.1.1", "Math.E",            
65               2.7182818284590452354, 
66               Math.E );
67
68 new TestCase( "15.8.1.1",
69               "typeof Math.E",     
70               "number",              
71               typeof Math.E );
72
73 new TestCase( "15.8.1.2",
74               "Math.LN10",         
75               2.302585092994046,     
76               Math.LN10 );
77
78 new TestCase( "15.8.1.2",
79               "typeof Math.LN10",  
80               "number",              
81               typeof Math.LN10 );
82
83 new TestCase( "15.8.1.3",
84               "Math.LN2",         
85               0.6931471805599453,    
86               Math.LN2 );
87
88 new TestCase( "15.8.1.3",
89               "typeof Math.LN2",   
90               "number",              
91               typeof Math.LN2 );
92
93 new TestCase( "15.8.1.4",
94               "Math.LOG2E",        
95               1.4426950408889634,    
96               Math.LOG2E );
97
98 new TestCase( "15.8.1.4",
99               "typeof Math.LOG2E", 
100               "number",              
101               typeof Math.LOG2E );
102
103 new TestCase( "15.8.1.5",
104               "Math.LOG10E",       
105               0.4342944819032518,    
106               Math.LOG10E);
107
108 new TestCase( "15.8.1.5",
109               "typeof Math.LOG10E",
110               "number",              
111               typeof Math.LOG10E);
112
113 new TestCase( "15.8.1.6",
114               "Math.PI",           
115               3.14159265358979323846,
116               Math.PI );
117
118 new TestCase( "15.8.1.6",
119               "typeof Math.PI",    
120               "number",              
121               typeof Math.PI );
122
123 new TestCase( "15.8.1.7",
124               "Math.SQRT1_2",      
125               0.7071067811865476,    
126               Math.SQRT1_2);
127
128 new TestCase( "15.8.1.7",
129               "typeof Math.SQRT1_2",
130               "number",             
131               typeof Math.SQRT1_2);
132
133 new TestCase( "15.8.1.8",
134               "Math.SQRT2",        
135               1.4142135623730951,    
136               Math.SQRT2 );
137
138 new TestCase( "15.8.1.8",
139               "typeof Math.SQRT2", 
140               "number",              
141               typeof Math.SQRT2 );
142
143 new TestCase( SECTION, 
144               "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
145               "",
146               eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
147
148 test();