Debian Codegraph @

rhino/testsrc/tests/ecma/Math/15.8.2.5.js

raw symbols SCIP
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 gTestfile = '15.8.2.5.js';
7
8 /**
9 File Name: 15.8.2.5.js
10 ECMA Section: 15.8.2.5 atan2( y, x )
11 Description:
12
13 Author: [email protected]
14 Date: 7 july 1997
15
16 */
17 var SECTION = "15.8.2.5";
18 var VERSION = "ECMA_1";
19 var TITLE = "Math.atan2(x,y)";
20 var BUGNUMBER="76111";
21
22 startTest();
23
24 writeHeaderToLog( SECTION + " "+ TITLE);
25
26 new TestCase( SECTION,
27 "Math.atan2.length",
28 2,
29 Math.atan2.length );
30
31 new TestCase( SECTION,
32 "Math.atan2(NaN, 0)",
33 Number.NaN,
34 Math.atan2(Number.NaN,0) );
35
36 new TestCase( SECTION,
37 "Math.atan2(null, null)",
38 0,
39 Math.atan2(null, null) );
40
41 new TestCase( SECTION,
42 "Math.atan2(void 0, void 0)",
43 Number.NaN,
44 Math.atan2(void 0, void 0) );
45
46 new TestCase( SECTION,
47 "Math.atan2()",
48 Number.NaN,
49 Math.atan2() );
50
51 new TestCase( SECTION,
52 "Math.atan2(0, NaN)",
53 Number.NaN,
54 Math.atan2(0,Number.NaN) );
55
56 new TestCase( SECTION,
57 "Math.atan2(1, 0)",
58 Math.PI/2,
59 Math.atan2(1,0) );
60
61 new TestCase( SECTION,
62 "Math.atan2(1,-0)",
63 Math.PI/2,
64 Math.atan2(1,-0) );
65
66 new TestCase( SECTION,
67 "Math.atan2(0,0.001)",
68 0,
69 Math.atan2(0,0.001) );
70
71 new TestCase( SECTION,
72 "Math.atan2(0,0)",
73 0,
74 Math.atan2(0,0) );
75
76 new TestCase( SECTION,
77 "Math.atan2(0, -0)",
78 Math.PI,
79 Math.atan2(0,-0) );
80
81 new TestCase( SECTION,
82 "Math.atan2(0, -1)",
83 Math.PI,
84 Math.atan2(0, -1) );
85
86 new TestCase( SECTION,
87 "Math.atan2(-0, 1)",
88 -0,
89 Math.atan2(-0, 1) );
90
91 new TestCase( SECTION,
92 "Infinity/Math.atan2(-0, 1)",
93 -Infinity,
94 Infinity/Math.atan2(-0,1) );
95
96 new TestCase( SECTION,
97 "Math.atan2(-0, 0)",
98 -0,
99 Math.atan2(-0,0) );
100
101 new TestCase( SECTION,
102 "Math.atan2(-0, -0)",
103 -Math.PI,
104 Math.atan2(-0, -0) );
105
106 new TestCase( SECTION,
107 "Math.atan2(-0, -1)",
108 -Math.PI,
109 Math.atan2(-0, -1) );
110
111 new TestCase( SECTION,
112 "Math.atan2(-1, 0)",
113 -Math.PI/2,
114 Math.atan2(-1, 0) );
115
116 new TestCase( SECTION,
117 "Math.atan2(-1, -0)",
118 -Math.PI/2,
119 Math.atan2(-1, -0) );
120
121 new TestCase( SECTION,
122 "Math.atan2(1, Infinity)",
123 0,
124 Math.atan2(1, Number.POSITIVE_INFINITY) );
125
126 new TestCase( SECTION,
127 "Math.atan2(1,-Infinity)",
128 Math.PI,
129 Math.atan2(1, Number.NEGATIVE_INFINITY) );
130
131 new TestCase( SECTION,
132 "Math.atan2(-1, Infinity)",
133 -0,
134 Math.atan2(-1,Number.POSITIVE_INFINITY) );
135
136 new TestCase( SECTION,
137 "Infinity/Math.atan2(-1, Infinity)",
138 -Infinity,
139 Infinity/Math.atan2(-1,Infinity) );
140
141 new TestCase( SECTION,
142 "Math.atan2(-1,-Infinity)",
143 -Math.PI,
144 Math.atan2(-1,Number.NEGATIVE_INFINITY) );
145
146 new TestCase( SECTION,
147 "Math.atan2(Infinity, 0)",
148 Math.PI/2,
149 Math.atan2(Number.POSITIVE_INFINITY, 0) );
150
151 new TestCase( SECTION,
152 "Math.atan2(Infinity, 1)",
153 Math.PI/2,
154 Math.atan2(Number.POSITIVE_INFINITY, 1) );
155
156 new TestCase( SECTION,
157 "Math.atan2(Infinity,-1)",
158 Math.PI/2,
159 Math.atan2(Number.POSITIVE_INFINITY,-1) );
160
161 new TestCase( SECTION,
162 "Math.atan2(Infinity,-0)",
163 Math.PI/2,
164 Math.atan2(Number.POSITIVE_INFINITY,-0) );
165
166 new TestCase( SECTION,
167 "Math.atan2(-Infinity, 0)",
168 -Math.PI/2,
169 Math.atan2(Number.NEGATIVE_INFINITY, 0) );
170
171 new TestCase( SECTION,
172 "Math.atan2(-Infinity,-0)",
173 -Math.PI/2,
174 Math.atan2(Number.NEGATIVE_INFINITY,-0) );
175
176 new TestCase( SECTION,
177 "Math.atan2(-Infinity, 1)",
178 -Math.PI/2,
179 Math.atan2(Number.NEGATIVE_INFINITY, 1) );
180
181 new TestCase( SECTION,
182 "Math.atan2(-Infinity, -1)",
183 -Math.PI/2,
184 Math.atan2(Number.NEGATIVE_INFINITY,-1) );
185
186 new TestCase( SECTION,
187 "Math.atan2(Infinity, Infinity)",
188 Math.PI/4,
189 Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
190
191 new TestCase( SECTION,
192 "Math.atan2(Infinity, -Infinity)",
193 3*Math.PI/4,
194 Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
195
196 new TestCase( SECTION,
197 "Math.atan2(-Infinity, Infinity)",
198 -Math.PI/4,
199 Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
200
201 new TestCase( SECTION,
202 "Math.atan2(-Infinity, -Infinity)",
203 -3*Math.PI/4,
204 Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
205
206 new TestCase( SECTION,
207 "Math.atan2(-1, 1)",
208 -Math.PI/4,
209 Math.atan2( -1, 1) );
210
211 test();