Debian Codegraph @

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