]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Math/15.8.2.16.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.8.2.16.js
24 ECMA Section: 15.8.2.16 sin( x )
25 Description: return an approximation to the sine of the
26 argument. argument is expressed in radians
27 Author: christine@netscape.com
31 var SECTION
= "15.8.2.16";
32 var VERSION
= "ECMA_1";
34 var TITLE
= "Math.sin(x)";
36 writeHeaderToLog( SECTION
+ " "+ TITLE
);
38 var testcases
= getTestCases();
41 function getTestCases() {
42 var array
= new Array();
45 array
[item
++] = new TestCase( SECTION
, "Math.sin.length", 1, Math
.sin
.length
);
47 array
[item
++] = new TestCase( SECTION
, "Math.sin()", Number
.NaN
, Math
.sin() );
48 array
[item
++] = new TestCase( SECTION
, "Math.sin(null)", 0, Math
.sin(null) );
49 array
[item
++] = new TestCase( SECTION
, "Math.sin(void 0)", Number
.NaN
, Math
.sin(void 0) );
50 array
[item
++] = new TestCase( SECTION
, "Math.sin(false)", 0, Math
.sin(false) );
51 array
[item
++] = new TestCase( SECTION
, "Math.sin('2.356194490192')", 0.7071067811865, Math
.sin('2.356194490192') );
53 array
[item
++] = new TestCase( SECTION
, "Math.sin(NaN)", Number
.NaN
, Math
.sin(Number
.NaN
) );
54 array
[item
++] = new TestCase( SECTION
, "Math.sin(0)", 0, Math
.sin(0) );
55 array
[item
++] = new TestCase( SECTION
, "Math.sin(-0)", -0, Math
.sin(-0));
56 array
[item
++] = new TestCase( SECTION
, "Math.sin(Infinity)", Number
.NaN
, Math
.sin(Number
.POSITIVE_INFINITY
));
57 array
[item
++] = new TestCase( SECTION
, "Math.sin(-Infinity)", Number
.NaN
, Math
.sin(Number
.NEGATIVE_INFINITY
));
58 array
[item
++] = new TestCase( SECTION
, "Math.sin(0.7853981633974)", 0.7071067811865, Math
.sin(0.7853981633974));
59 array
[item
++] = new TestCase( SECTION
, "Math.sin(1.570796326795)", 1, Math
.sin(1.570796326795));
60 array
[item
++] = new TestCase( SECTION
, "Math.sin(2.356194490192)", 0.7071067811865, Math
.sin(2.356194490192));
61 array
[item
++] = new TestCase( SECTION
, "Math.sin(3.14159265359)", 0, Math
.sin(3.14159265359));
67 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
68 testcases
[tc
].passed
= writeTestCaseResult(
71 testcases
[tc
].description
+" = "+
72 testcases
[tc
].actual
);
74 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";