|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 |
|
7 /** |
|
8 File Name: 15.8.2.5.js |
|
9 ECMA Section: 15.8.2.5 atan2( y, x ) |
|
10 Description: |
|
11 |
|
12 Author: christine@netscape.com |
|
13 Date: 7 july 1997 |
|
14 |
|
15 */ |
|
16 var SECTION = "15.8.2.5"; |
|
17 var VERSION = "ECMA_1"; |
|
18 var TITLE = "Math.atan2(x,y)"; |
|
19 var BUGNUMBER="76111"; |
|
20 |
|
21 startTest(); |
|
22 |
|
23 writeHeaderToLog( SECTION + " "+ TITLE); |
|
24 |
|
25 new TestCase( SECTION, |
|
26 "Math.atan2.length", |
|
27 2, |
|
28 Math.atan2.length ); |
|
29 |
|
30 new TestCase( SECTION, |
|
31 "Math.atan2(NaN, 0)", |
|
32 Number.NaN, |
|
33 Math.atan2(Number.NaN,0) ); |
|
34 |
|
35 new TestCase( SECTION, |
|
36 "Math.atan2(null, null)", |
|
37 0, |
|
38 Math.atan2(null, null) ); |
|
39 |
|
40 new TestCase( SECTION, |
|
41 "Math.atan2(void 0, void 0)", |
|
42 Number.NaN, |
|
43 Math.atan2(void 0, void 0) ); |
|
44 |
|
45 new TestCase( SECTION, |
|
46 "Math.atan2()", |
|
47 Number.NaN, |
|
48 Math.atan2() ); |
|
49 |
|
50 new TestCase( SECTION, |
|
51 "Math.atan2(0, NaN)", |
|
52 Number.NaN, |
|
53 Math.atan2(0,Number.NaN) ); |
|
54 |
|
55 new TestCase( SECTION, |
|
56 "Math.atan2(1, 0)", |
|
57 Math.PI/2, |
|
58 Math.atan2(1,0) ); |
|
59 |
|
60 new TestCase( SECTION, |
|
61 "Math.atan2(1,-0)", |
|
62 Math.PI/2, |
|
63 Math.atan2(1,-0) ); |
|
64 |
|
65 new TestCase( SECTION, |
|
66 "Math.atan2(0,0.001)", |
|
67 0, |
|
68 Math.atan2(0,0.001) ); |
|
69 |
|
70 new TestCase( SECTION, |
|
71 "Math.atan2(0,0)", |
|
72 0, |
|
73 Math.atan2(0,0) ); |
|
74 |
|
75 new TestCase( SECTION, |
|
76 "Math.atan2(0, -0)", |
|
77 Math.PI, |
|
78 Math.atan2(0,-0) ); |
|
79 |
|
80 new TestCase( SECTION, |
|
81 "Math.atan2(0, -1)", |
|
82 Math.PI, |
|
83 Math.atan2(0, -1) ); |
|
84 |
|
85 new TestCase( SECTION, |
|
86 "Math.atan2(-0, 1)", |
|
87 -0, |
|
88 Math.atan2(-0, 1) ); |
|
89 |
|
90 new TestCase( SECTION, |
|
91 "Infinity/Math.atan2(-0, 1)", |
|
92 -Infinity, |
|
93 Infinity/Math.atan2(-0,1) ); |
|
94 |
|
95 new TestCase( SECTION, |
|
96 "Math.atan2(-0, 0)", |
|
97 -0, |
|
98 Math.atan2(-0,0) ); |
|
99 |
|
100 new TestCase( SECTION, |
|
101 "Math.atan2(-0, -0)", |
|
102 -Math.PI, |
|
103 Math.atan2(-0, -0) ); |
|
104 |
|
105 new TestCase( SECTION, |
|
106 "Math.atan2(-0, -1)", |
|
107 -Math.PI, |
|
108 Math.atan2(-0, -1) ); |
|
109 |
|
110 new TestCase( SECTION, |
|
111 "Math.atan2(-1, 0)", |
|
112 -Math.PI/2, |
|
113 Math.atan2(-1, 0) ); |
|
114 |
|
115 new TestCase( SECTION, |
|
116 "Math.atan2(-1, -0)", |
|
117 -Math.PI/2, |
|
118 Math.atan2(-1, -0) ); |
|
119 |
|
120 new TestCase( SECTION, |
|
121 "Math.atan2(1, Infinity)", |
|
122 0, |
|
123 Math.atan2(1, Number.POSITIVE_INFINITY) ); |
|
124 |
|
125 new TestCase( SECTION, |
|
126 "Math.atan2(1,-Infinity)", |
|
127 Math.PI, |
|
128 Math.atan2(1, Number.NEGATIVE_INFINITY) ); |
|
129 |
|
130 new TestCase( SECTION, |
|
131 "Math.atan2(-1, Infinity)", |
|
132 -0, |
|
133 Math.atan2(-1,Number.POSITIVE_INFINITY) ); |
|
134 |
|
135 new TestCase( SECTION, |
|
136 "Infinity/Math.atan2(-1, Infinity)", |
|
137 -Infinity, |
|
138 Infinity/Math.atan2(-1,Infinity) ); |
|
139 |
|
140 new TestCase( SECTION, |
|
141 "Math.atan2(-1,-Infinity)", |
|
142 -Math.PI, |
|
143 Math.atan2(-1,Number.NEGATIVE_INFINITY) ); |
|
144 |
|
145 new TestCase( SECTION, |
|
146 "Math.atan2(Infinity, 0)", |
|
147 Math.PI/2, |
|
148 Math.atan2(Number.POSITIVE_INFINITY, 0) ); |
|
149 |
|
150 new TestCase( SECTION, |
|
151 "Math.atan2(Infinity, 1)", |
|
152 Math.PI/2, |
|
153 Math.atan2(Number.POSITIVE_INFINITY, 1) ); |
|
154 |
|
155 new TestCase( SECTION, |
|
156 "Math.atan2(Infinity,-1)", |
|
157 Math.PI/2, |
|
158 Math.atan2(Number.POSITIVE_INFINITY,-1) ); |
|
159 |
|
160 new TestCase( SECTION, |
|
161 "Math.atan2(Infinity,-0)", |
|
162 Math.PI/2, |
|
163 Math.atan2(Number.POSITIVE_INFINITY,-0) ); |
|
164 |
|
165 new TestCase( SECTION, |
|
166 "Math.atan2(-Infinity, 0)", |
|
167 -Math.PI/2, |
|
168 Math.atan2(Number.NEGATIVE_INFINITY, 0) ); |
|
169 |
|
170 new TestCase( SECTION, |
|
171 "Math.atan2(-Infinity,-0)", |
|
172 -Math.PI/2, |
|
173 Math.atan2(Number.NEGATIVE_INFINITY,-0) ); |
|
174 |
|
175 new TestCase( SECTION, |
|
176 "Math.atan2(-Infinity, 1)", |
|
177 -Math.PI/2, |
|
178 Math.atan2(Number.NEGATIVE_INFINITY, 1) ); |
|
179 |
|
180 new TestCase( SECTION, |
|
181 "Math.atan2(-Infinity, -1)", |
|
182 -Math.PI/2, |
|
183 Math.atan2(Number.NEGATIVE_INFINITY,-1) ); |
|
184 |
|
185 new TestCase( SECTION, |
|
186 "Math.atan2(Infinity, Infinity)", |
|
187 Math.PI/4, |
|
188 Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); |
|
189 |
|
190 new TestCase( SECTION, |
|
191 "Math.atan2(Infinity, -Infinity)", |
|
192 3*Math.PI/4, |
|
193 Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); |
|
194 |
|
195 new TestCase( SECTION, |
|
196 "Math.atan2(-Infinity, Infinity)", |
|
197 -Math.PI/4, |
|
198 Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); |
|
199 |
|
200 new TestCase( SECTION, |
|
201 "Math.atan2(-Infinity, -Infinity)", |
|
202 -3*Math.PI/4, |
|
203 Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); |
|
204 |
|
205 new TestCase( SECTION, |
|
206 "Math.atan2(-1, 1)", |
|
207 -Math.PI/4, |
|
208 Math.atan2( -1, 1) ); |
|
209 |
|
210 test(); |