js/src/tests/ecma/Math/15.8.2.7.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:39119a7ab177
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.7.js
9 ECMA Section: 15.8.2.7 cos( x )
10 Description: return an approximation to the cosine of the
11 argument. argument is expressed in radians
12 Author: christine@netscape.com
13 Date: 7 july 1997
14
15 */
16
17 var SECTION = "15.8.2.7";
18 var VERSION = "ECMA_1";
19 startTest();
20 var TITLE = "Math.cos(x)";
21
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 new TestCase( SECTION,
25 "Math.cos.length",
26 1,
27 Math.cos.length );
28
29 new TestCase( SECTION,
30 "Math.cos()",
31 Number.NaN,
32 Math.cos() );
33
34 new TestCase( SECTION,
35 "Math.cos(void 0)",
36 Number.NaN,
37 Math.cos(void 0) );
38
39 new TestCase( SECTION,
40 "Math.cos(false)",
41 1,
42 Math.cos(false) );
43
44 new TestCase( SECTION,
45 "Math.cos(null)",
46 1,
47 Math.cos(null) );
48
49 new TestCase( SECTION,
50 "Math.cos('0')",
51 1,
52 Math.cos('0') );
53
54 new TestCase( SECTION,
55 "Math.cos('Infinity')",
56 Number.NaN,
57 Math.cos("Infinity") );
58
59 new TestCase( SECTION,
60 "Math.cos('3.14159265359')",
61 -1,
62 Math.cos('3.14159265359') );
63
64 new TestCase( SECTION,
65 "Math.cos(NaN)",
66 Number.NaN,
67 Math.cos(Number.NaN) );
68
69 new TestCase( SECTION,
70 "Math.cos(0)",
71 1,
72 Math.cos(0) );
73
74 new TestCase( SECTION,
75 "Math.cos(-0)",
76 1,
77 Math.cos(-0) );
78
79 new TestCase( SECTION,
80 "Math.cos(Infinity)",
81 Number.NaN,
82 Math.cos(Number.POSITIVE_INFINITY) );
83
84 new TestCase( SECTION,
85 "Math.cos(-Infinity)",
86 Number.NaN,
87 Math.cos(Number.NEGATIVE_INFINITY) );
88
89 new TestCase( SECTION,
90 "Math.cos(0.7853981633974)",
91 0.7071067811865,
92 Math.cos(0.7853981633974) );
93
94 new TestCase( SECTION,
95 "Math.cos(1.570796326795)",
96 0,
97 Math.cos(1.570796326795) );
98
99 new TestCase( SECTION,
100 "Math.cos(2.356194490192)",
101 -0.7071067811865,
102 Math.cos(2.356194490192) );
103
104 new TestCase( SECTION,
105 "Math.cos(3.14159265359)",
106 -1,
107 Math.cos(3.14159265359) );
108
109 new TestCase( SECTION,
110 "Math.cos(3.926990816987)",
111 -0.7071067811865,
112 Math.cos(3.926990816987) );
113
114 new TestCase( SECTION,
115 "Math.cos(4.712388980385)",
116 0,
117 Math.cos(4.712388980385) );
118
119 new TestCase( SECTION,
120 "Math.cos(5.497787143782)",
121 0.7071067811865,
122 Math.cos(5.497787143782) );
123
124 new TestCase( SECTION,
125 "Math.cos(Math.PI*2)",
126 1,
127 Math.cos(Math.PI*2) );
128
129 new TestCase( SECTION,
130 "Math.cos(Math.PI/4)",
131 Math.SQRT2/2,
132 Math.cos(Math.PI/4) );
133
134 new TestCase( SECTION,
135 "Math.cos(Math.PI/2)",
136 0,
137 Math.cos(Math.PI/2) );
138
139 new TestCase( SECTION,
140 "Math.cos(3*Math.PI/4)",
141 -Math.SQRT2/2,
142 Math.cos(3*Math.PI/4) );
143
144 new TestCase( SECTION,
145 "Math.cos(Math.PI)",
146 -1,
147 Math.cos(Math.PI) );
148
149 new TestCase( SECTION,
150 "Math.cos(5*Math.PI/4)",
151 -Math.SQRT2/2,
152 Math.cos(5*Math.PI/4) );
153
154 new TestCase( SECTION,
155 "Math.cos(3*Math.PI/2)",
156 0,
157 Math.cos(3*Math.PI/2) );
158
159 new TestCase( SECTION,
160 "Math.cos(7*Math.PI/4)",
161 Math.SQRT2/2,
162 Math.cos(7*Math.PI/4) );
163
164 new TestCase( SECTION,
165 "Math.cos(Math.PI*2)",
166 1,
167 Math.cos(2*Math.PI) );
168
169 new TestCase( SECTION,
170 "Math.cos(-0.7853981633974)",
171 0.7071067811865,
172 Math.cos(-0.7853981633974) );
173
174 new TestCase( SECTION,
175 "Math.cos(-1.570796326795)",
176 0,
177 Math.cos(-1.570796326795) );
178
179 new TestCase( SECTION,
180 "Math.cos(-2.3561944901920)",
181 -.7071067811865,
182 Math.cos(2.3561944901920) );
183
184 new TestCase( SECTION,
185 "Math.cos(-3.14159265359)",
186 -1,
187 Math.cos(3.14159265359) );
188
189 new TestCase( SECTION,
190 "Math.cos(-3.926990816987)",
191 -0.7071067811865,
192 Math.cos(3.926990816987) );
193
194 new TestCase( SECTION,
195 "Math.cos(-4.712388980385)",
196 0,
197 Math.cos(4.712388980385) );
198
199 new TestCase( SECTION,
200 "Math.cos(-5.497787143782)",
201 0.7071067811865,
202 Math.cos(5.497787143782) );
203
204 new TestCase( SECTION,
205 "Math.cos(-6.28318530718)",
206 1,
207 Math.cos(6.28318530718) );
208
209 new TestCase( SECTION,
210 "Math.cos(-Math.PI/4)",
211 Math.SQRT2/2,
212 Math.cos(-Math.PI/4) );
213
214 new TestCase( SECTION,
215 "Math.cos(-Math.PI/2)",
216 0,
217 Math.cos(-Math.PI/2) );
218
219 new TestCase( SECTION,
220 "Math.cos(-3*Math.PI/4)",
221 -Math.SQRT2/2,
222 Math.cos(-3*Math.PI/4) );
223
224 new TestCase( SECTION,
225 "Math.cos(-Math.PI)",
226 -1,
227 Math.cos(-Math.PI) );
228
229 new TestCase( SECTION,
230 "Math.cos(-5*Math.PI/4)",
231 -Math.SQRT2/2,
232 Math.cos(-5*Math.PI/4) );
233
234 new TestCase( SECTION,
235 "Math.cos(-3*Math.PI/2)",
236 0,
237 Math.cos(-3*Math.PI/2) );
238
239 new TestCase( SECTION,
240 "Math.cos(-7*Math.PI/4)",
241 Math.SQRT2/2,
242 Math.cos(-7*Math.PI/4) );
243
244 new TestCase( SECTION,
245 "Math.cos(-Math.PI*2)",
246 1,
247 Math.cos(-Math.PI*2) );
248
249 test();

mercurial