]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Math/15.8.2.4.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.4.js
24 ECMA Section: 15.8.2.4 atan( x )
25 Description: return an approximation to the arc tangent of the
26 argument. the result is expressed in radians and
27 range is from -PI/2 to +PI/2. special cases:
28 - if x is NaN, the result is NaN
29 - if x == +0, the result is +0
30 - if x == -0, the result is -0
31 - if x == +Infinity, the result is approximately +PI/2
32 - if x == -Infinity, the result is approximately -PI/2
33 Author: christine@netscape.com
38 var SECTION
= "15.8.2.4";
39 var VERSION
= "ECMA_1";
41 var TITLE
= "Math.atan()";
42 var BUGNUMBER
="77391";
44 writeHeaderToLog( SECTION
+ " "+ TITLE
);
46 var testcases
= getTestCases();
49 function getTestCases() {
50 var array
= new Array();
53 array
[item
++] = new TestCase( SECTION
, "Math.atan.length", 1, Math
.atan
.length
);
55 array
[item
++] = new TestCase( SECTION
, "Math.atan()", Number
.NaN
, Math
.atan() );
56 array
[item
++] = new TestCase( SECTION
, "Math.atan(void 0)", Number
.NaN
, Math
.atan(void 0) );
57 array
[item
++] = new TestCase( SECTION
, "Math.atan(null)", 0, Math
.atan(null) );
58 array
[item
++] = new TestCase( SECTION
, "Math.atan(NaN)", Number
.NaN
, Math
.atan(Number
.NaN
) );
60 array
[item
++] = new TestCase( SECTION
, "Math.atan('a string')", Number
.NaN
, Math
.atan("a string") );
61 array
[item
++] = new TestCase( SECTION
, "Math.atan('0')", 0, Math
.atan('0') );
62 array
[item
++] = new TestCase( SECTION
, "Math.atan('1')", Math
.PI
/4, Math
.atan('1') );
63 array
[item
++] = new TestCase( SECTION
, "Math.atan('-1')", -Math
.PI
/4, Math
.atan('-1') );
64 array
[item
++] = new TestCase( SECTION
, "Math.atan('Infinity)", Math
.PI
/2, Math
.atan('Infinity') );
65 array
[item
++] = new TestCase( SECTION
, "Math.atan('-Infinity)", -Math
.PI
/2, Math
.atan('-Infinity') );
67 array
[item
++] = new TestCase( SECTION
, "Math.atan(0)", 0, Math
.atan(0) );
68 array
[item
++] = new TestCase( SECTION
, "Math.atan(-0)", -0, Math
.atan(-0) );
69 array
[item
++] = new TestCase( SECTION
, "Infinity/Math.atan(-0)", -Infinity
, Infinity
/Math
.atan(-0) );
70 array
[item
++] = new TestCase( SECTION
, "Math.atan(Infinity)", Math
.PI
/2, Math
.atan(Number
.POSITIVE_INFINITY
) );
71 array
[item
++] = new TestCase( SECTION
, "Math.atan(-Infinity)", -Math
.PI
/2, Math
.atan(Number
.NEGATIVE_INFINITY
) );
72 array
[item
++] = new TestCase( SECTION
, "Math.atan(1)", Math
.PI
/4, Math
.atan(1) );
73 array
[item
++] = new TestCase( SECTION
, "Math.atan(-1)", -Math
.PI
/4, Math
.atan(-1) );
77 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
78 testcases
[tc
].passed
= writeTestCaseResult(
81 testcases
[tc
].description
+" = "+
82 testcases
[tc
].actual
);
84 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";