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.7.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.7.js
42    ECMA Section:       15.8.2.7 cos( x )
43    Description:        return an approximation to the cosine of the
44    argument.  argument is expressed in radians
45    Author:             christine@netscape.com
46    Date:               7 july 1997
47
48 */
49
50 var SECTION = "15.8.2.7";
51 var VERSION = "ECMA_1";
52 startTest();
53 var TITLE   = "Math.cos(x)";
54
55 writeHeaderToLog( SECTION + " "+ TITLE);
56
57 new TestCase( SECTION,
58               "Math.cos.length",
59               1,
60               Math.cos.length );
61
62 new TestCase( SECTION,
63               "Math.cos()",
64               Number.NaN,
65               Math.cos() );
66
67 new TestCase( SECTION,
68               "Math.cos(void 0)",
69               Number.NaN,
70               Math.cos(void 0) );
71
72 new TestCase( SECTION,
73               "Math.cos(false)",
74               1,
75               Math.cos(false) );
76
77 new TestCase( SECTION,
78               "Math.cos(null)",
79               1,
80               Math.cos(null) );
81
82 new TestCase( SECTION,
83               "Math.cos('0')",
84               1,
85               Math.cos('0') );
86
87 new TestCase( SECTION,
88               "Math.cos('Infinity')",
89               Number.NaN,
90               Math.cos("Infinity") );
91
92 new TestCase( SECTION,
93               "Math.cos('3.14159265359')",
94               -1,
95               Math.cos('3.14159265359') );
96
97 new TestCase( SECTION,
98               "Math.cos(NaN)",
99               Number.NaN,
100               Math.cos(Number.NaN)        );
101
102 new TestCase( SECTION,
103               "Math.cos(0)",
104               1,
105               Math.cos(0)                 );
106
107 new TestCase( SECTION,
108               "Math.cos(-0)",
109               1,
110               Math.cos(-0)                );
111
112 new TestCase( SECTION,
113               "Math.cos(Infinity)",
114               Number.NaN,
115               Math.cos(Number.POSITIVE_INFINITY) );
116
117 new TestCase( SECTION,
118               "Math.cos(-Infinity)",
119               Number.NaN,
120               Math.cos(Number.NEGATIVE_INFINITY) );
121
122 new TestCase( SECTION,
123               "Math.cos(0.7853981633974)",
124               0.7071067811865,
125               Math.cos(0.7853981633974)   );
126
127 new TestCase( SECTION,
128               "Math.cos(1.570796326795)",
129               0,
130               Math.cos(1.570796326795)    );
131
132 new TestCase( SECTION,
133               "Math.cos(2.356194490192)",
134               -0.7071067811865,
135               Math.cos(2.356194490192)    );
136
137 new TestCase( SECTION,
138               "Math.cos(3.14159265359)",
139               -1,
140               Math.cos(3.14159265359)     );
141
142 new TestCase( SECTION,
143               "Math.cos(3.926990816987)",
144               -0.7071067811865,
145               Math.cos(3.926990816987)    );
146
147 new TestCase( SECTION,
148               "Math.cos(4.712388980385)",
149               0,
150               Math.cos(4.712388980385)    );
151
152 new TestCase( SECTION,
153               "Math.cos(5.497787143782)",
154               0.7071067811865,
155               Math.cos(5.497787143782)    );
156
157 new TestCase( SECTION,
158               "Math.cos(Math.PI*2)",
159               1,
160               Math.cos(Math.PI*2)         );
161
162 new TestCase( SECTION,
163               "Math.cos(Math.PI/4)",
164               Math.SQRT2/2,
165               Math.cos(Math.PI/4)         );
166
167 new TestCase( SECTION,
168               "Math.cos(Math.PI/2)",
169               0,
170               Math.cos(Math.PI/2)         );
171
172 new TestCase( SECTION,
173               "Math.cos(3*Math.PI/4)",
174               -Math.SQRT2/2,
175               Math.cos(3*Math.PI/4)       );
176
177 new TestCase( SECTION,
178               "Math.cos(Math.PI)",
179               -1,
180               Math.cos(Math.PI)           );
181
182 new TestCase( SECTION,
183               "Math.cos(5*Math.PI/4)",
184               -Math.SQRT2/2,
185               Math.cos(5*Math.PI/4)       );
186
187 new TestCase( SECTION,
188               "Math.cos(3*Math.PI/2)",
189               0,
190               Math.cos(3*Math.PI/2)       );
191
192 new TestCase( SECTION,
193               "Math.cos(7*Math.PI/4)",
194               Math.SQRT2/2,
195               Math.cos(7*Math.PI/4)       );
196
197 new TestCase( SECTION,
198               "Math.cos(Math.PI*2)",
199               1,
200               Math.cos(2*Math.PI)         );
201
202 new TestCase( SECTION,
203               "Math.cos(-0.7853981633974)",
204               0.7071067811865,
205               Math.cos(-0.7853981633974)  );
206
207 new TestCase( SECTION,
208               "Math.cos(-1.570796326795)",
209               0,
210               Math.cos(-1.570796326795)   );
211
212 new TestCase( SECTION,
213               "Math.cos(-2.3561944901920)",
214               -.7071067811865,
215               Math.cos(2.3561944901920)   );
216
217 new TestCase( SECTION,
218               "Math.cos(-3.14159265359)",
219               -1,
220               Math.cos(3.14159265359)     );
221
222 new TestCase( SECTION,
223               "Math.cos(-3.926990816987)",
224               -0.7071067811865,
225               Math.cos(3.926990816987)    );
226
227 new TestCase( SECTION,
228               "Math.cos(-4.712388980385)",
229               0,
230               Math.cos(4.712388980385)    );
231
232 new TestCase( SECTION,
233               "Math.cos(-5.497787143782)",
234               0.7071067811865,
235               Math.cos(5.497787143782)    );
236
237 new TestCase( SECTION,
238               "Math.cos(-6.28318530718)",
239               1,
240               Math.cos(6.28318530718)     );
241
242 new TestCase( SECTION,
243               "Math.cos(-Math.PI/4)",
244               Math.SQRT2/2,
245               Math.cos(-Math.PI/4)        );
246
247 new TestCase( SECTION,
248               "Math.cos(-Math.PI/2)",
249               0,
250               Math.cos(-Math.PI/2)        );
251
252 new TestCase( SECTION,
253               "Math.cos(-3*Math.PI/4)",
254               -Math.SQRT2/2,
255               Math.cos(-3*Math.PI/4)      );
256
257 new TestCase( SECTION,
258               "Math.cos(-Math.PI)",
259               -1,
260               Math.cos(-Math.PI)          );
261
262 new TestCase( SECTION,
263               "Math.cos(-5*Math.PI/4)",
264               -Math.SQRT2/2,
265               Math.cos(-5*Math.PI/4)      );
266
267 new TestCase( SECTION,
268               "Math.cos(-3*Math.PI/2)",
269               0,
270               Math.cos(-3*Math.PI/2)      );
271
272 new TestCase( SECTION,
273               "Math.cos(-7*Math.PI/4)",
274               Math.SQRT2/2,
275               Math.cos(-7*Math.PI/4)      );
276
277 new TestCase( SECTION,
278               "Math.cos(-Math.PI*2)",
279               1,
280               Math.cos(-Math.PI*2)        );
281
282 test();