Merge "fix: the incorrect version of tarball generated by gbs export" into tizen
[platform/upstream/js.git] / js / src / tests / ecma / Math / 15.8.2.5.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.2.5.js
42    ECMA Section:       15.8.2.5 atan2( y, x )
43    Description:
44
45    Author:             christine@netscape.com
46    Date:               7 july 1997
47
48 */
49 var SECTION = "15.8.2.5";
50 var VERSION = "ECMA_1";
51 var TITLE   = "Math.atan2(x,y)";
52 var BUGNUMBER="76111";
53
54 startTest();
55
56 writeHeaderToLog( SECTION + " "+ TITLE);
57
58 new TestCase( SECTION,
59               "Math.atan2.length",
60               2,
61               Math.atan2.length );
62
63 new TestCase( SECTION,
64               "Math.atan2(NaN, 0)",
65               Number.NaN,
66               Math.atan2(Number.NaN,0) );
67
68 new TestCase( SECTION,
69               "Math.atan2(null, null)",
70               0,
71               Math.atan2(null, null) );
72
73 new TestCase( SECTION,
74               "Math.atan2(void 0, void 0)",
75               Number.NaN,
76               Math.atan2(void 0, void 0) );
77
78 new TestCase( SECTION,
79               "Math.atan2()",
80               Number.NaN,
81               Math.atan2() );
82
83 new TestCase( SECTION,
84               "Math.atan2(0, NaN)",
85               Number.NaN,
86               Math.atan2(0,Number.NaN) );
87
88 new TestCase( SECTION,
89               "Math.atan2(1, 0)",
90               Math.PI/2,
91               Math.atan2(1,0)          );
92
93 new TestCase( SECTION,
94               "Math.atan2(1,-0)",
95               Math.PI/2,
96               Math.atan2(1,-0)         );
97
98 new TestCase( SECTION,
99               "Math.atan2(0,0.001)",
100               0,
101               Math.atan2(0,0.001)      );
102
103 new TestCase( SECTION,
104               "Math.atan2(0,0)",
105               0,
106               Math.atan2(0,0)          );
107
108 new TestCase( SECTION,
109               "Math.atan2(0, -0)",
110               Math.PI,
111               Math.atan2(0,-0)         );
112
113 new TestCase( SECTION,
114               "Math.atan2(0, -1)",
115               Math.PI,
116               Math.atan2(0, -1)        );
117
118 new TestCase( SECTION,
119               "Math.atan2(-0, 1)",
120               -0,
121               Math.atan2(-0, 1)        );
122
123 new TestCase( SECTION,
124               "Infinity/Math.atan2(-0, 1)",
125               -Infinity,
126               Infinity/Math.atan2(-0,1) );
127
128 new TestCase( SECTION,
129               "Math.atan2(-0,   0)",
130               -0,
131               Math.atan2(-0,0)         );
132
133 new TestCase( SECTION,
134               "Math.atan2(-0,   -0)",
135               -Math.PI,
136               Math.atan2(-0, -0)       );
137
138 new TestCase( SECTION,
139               "Math.atan2(-0,   -1)",
140               -Math.PI,
141               Math.atan2(-0, -1)       );
142
143 new TestCase( SECTION,
144               "Math.atan2(-1,   0)",
145               -Math.PI/2,
146               Math.atan2(-1, 0)        );
147
148 new TestCase( SECTION,
149               "Math.atan2(-1,   -0)",
150               -Math.PI/2,
151               Math.atan2(-1, -0)       );
152
153 new TestCase( SECTION,
154               "Math.atan2(1, Infinity)",
155               0,
156               Math.atan2(1, Number.POSITIVE_INFINITY) );
157
158 new TestCase( SECTION,
159               "Math.atan2(1,-Infinity)", 
160               Math.PI,
161               Math.atan2(1, Number.NEGATIVE_INFINITY) );
162
163 new TestCase( SECTION,
164               "Math.atan2(-1, Infinity)",
165               -0,
166               Math.atan2(-1,Number.POSITIVE_INFINITY) );
167
168 new TestCase( SECTION,
169               "Infinity/Math.atan2(-1, Infinity)",
170               -Infinity, 
171               Infinity/Math.atan2(-1,Infinity) );
172
173 new TestCase( SECTION,
174               "Math.atan2(-1,-Infinity)",
175               -Math.PI,
176               Math.atan2(-1,Number.NEGATIVE_INFINITY) );
177
178 new TestCase( SECTION,
179               "Math.atan2(Infinity, 0)", 
180               Math.PI/2,
181               Math.atan2(Number.POSITIVE_INFINITY, 0) );
182
183 new TestCase( SECTION,
184               "Math.atan2(Infinity, 1)", 
185               Math.PI/2,
186               Math.atan2(Number.POSITIVE_INFINITY, 1) );
187
188 new TestCase( SECTION,
189               "Math.atan2(Infinity,-1)", 
190               Math.PI/2,
191               Math.atan2(Number.POSITIVE_INFINITY,-1) );
192
193 new TestCase( SECTION,
194               "Math.atan2(Infinity,-0)", 
195               Math.PI/2,
196               Math.atan2(Number.POSITIVE_INFINITY,-0) );
197
198 new TestCase( SECTION,
199               "Math.atan2(-Infinity, 0)",
200               -Math.PI/2,
201               Math.atan2(Number.NEGATIVE_INFINITY, 0) );
202
203 new TestCase( SECTION,
204               "Math.atan2(-Infinity,-0)",
205               -Math.PI/2,
206               Math.atan2(Number.NEGATIVE_INFINITY,-0) );
207
208 new TestCase( SECTION,
209               "Math.atan2(-Infinity, 1)",
210               -Math.PI/2,
211               Math.atan2(Number.NEGATIVE_INFINITY, 1) );
212
213 new TestCase( SECTION,
214               "Math.atan2(-Infinity, -1)",
215               -Math.PI/2,
216               Math.atan2(Number.NEGATIVE_INFINITY,-1) );
217
218 new TestCase( SECTION,
219               "Math.atan2(Infinity, Infinity)",
220               Math.PI/4,
221               Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
222
223 new TestCase( SECTION,
224               "Math.atan2(Infinity, -Infinity)", 
225               3*Math.PI/4,
226               Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
227
228 new TestCase( SECTION,
229               "Math.atan2(-Infinity, Infinity)", 
230               -Math.PI/4,
231               Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
232
233 new TestCase( SECTION,
234               "Math.atan2(-Infinity, -Infinity)",
235               -3*Math.PI/4,
236               Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
237
238 new TestCase( SECTION,
239               "Math.atan2(-1, 1)",
240               -Math.PI/4,
241               Math.atan2( -1, 1) );
242
243 test();