]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Math/15.8.2.5.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.5.js
24 ECMA Section: 15.8.2.5 atan2( y, x )
27 Author: christine@netscape.com
31 var SECTION
= "15.8.2.5";
32 var VERSION
= "ECMA_1";
34 var TITLE
= "Math.atan2(x,y)";
35 var BUGNUMBER
="76111";
37 writeHeaderToLog( SECTION
+ " "+ TITLE
);
39 var testcases
= getTestCases();
42 function getTestCases() {
43 var array
= new Array();
46 array
[item
++] = new TestCase( SECTION
, "Math.atan2.length", 2, Math
.atan2
.length
);
48 array
[item
++] = new TestCase( SECTION
, "Math.atan2(NaN, 0)", Number
.NaN
, Math
.atan2(Number
.NaN
,0) );
49 array
[item
++] = new TestCase( SECTION
, "Math.atan2(null, null)", 0, Math
.atan2(null, null) );
50 array
[item
++] = new TestCase( SECTION
, "Math.atan2(void 0, void 0)", Number
.NaN
, Math
.atan2(void 0, void 0) );
51 array
[item
++] = new TestCase( SECTION
, "Math.atan2()", Number
.NaN
, Math
.atan2() );
53 array
[item
++] = new TestCase( SECTION
, "Math.atan2(0, NaN)", Number
.NaN
, Math
.atan2(0,Number
.NaN
) );
54 array
[item
++] = new TestCase( SECTION
, "Math.atan2(1, 0)", Math
.PI
/2, Math
.atan2(1,0) );
55 array
[item
++] = new TestCase( SECTION
, "Math.atan2(1,-0)", Math
.PI
/2, Math
.atan2(1,-0) );
56 array
[item
++] = new TestCase( SECTION
, "Math.atan2(0,0.001)", 0, Math
.atan2(0,0.001) );
57 array
[item
++] = new TestCase( SECTION
, "Math.atan2(0,0)", 0, Math
.atan2(0,0) );
58 array
[item
++] = new TestCase( SECTION
, "Math.atan2(0, -0)", Math
.PI
, Math
.atan2(0,-0) );
59 array
[item
++] = new TestCase( SECTION
, "Math.atan2(0, -1)", Math
.PI
, Math
.atan2(0, -1) );
61 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-0, 1)", -0, Math
.atan2(-0, 1) );
62 array
[item
++] = new TestCase( SECTION
, "Infinity/Math.atan2(-0, 1)", -Infinity
, Infinity
/Math
.atan2(-0,1) );
64 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-0, 0)", -0, Math
.atan2(-0,0) );
65 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-0, -0)", -Math
.PI
, Math
.atan2(-0, -0) );
66 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-0, -1)", -Math
.PI
, Math
.atan2(-0, -1) );
67 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-1, 0)", -Math
.PI
/2, Math
.atan2(-1, 0) );
68 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-1, -0)", -Math
.PI
/2, Math
.atan2(-1, -0) );
69 array
[item
++] = new TestCase( SECTION
, "Math.atan2(1, Infinity)", 0, Math
.atan2(1, Number
.POSITIVE_INFINITY
) );
70 array
[item
++] = new TestCase( SECTION
, "Math.atan2(1,-Infinity)", Math
.PI
, Math
.atan2(1, Number
.NEGATIVE_INFINITY
) );
72 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-1, Infinity)", -0, Math
.atan2(-1,Number
.POSITIVE_INFINITY
) );
73 array
[item
++] = new TestCase( SECTION
, "Infinity/Math.atan2(-1, Infinity)", -Infinity
, Infinity
/Math
.atan2(-1,Infinity
) );
75 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-1,-Infinity)", -Math
.PI
, Math
.atan2(-1,Number
.NEGATIVE_INFINITY
) );
76 array
[item
++] = new TestCase( SECTION
, "Math.atan2(Infinity, 0)", Math
.PI
/2, Math
.atan2(Number
.POSITIVE_INFINITY
, 0) );
77 array
[item
++] = new TestCase( SECTION
, "Math.atan2(Infinity, 1)", Math
.PI
/2, Math
.atan2(Number
.POSITIVE_INFINITY
, 1) );
78 array
[item
++] = new TestCase( SECTION
, "Math.atan2(Infinity,-1)", Math
.PI
/2, Math
.atan2(Number
.POSITIVE_INFINITY
,-1) );
79 array
[item
++] = new TestCase( SECTION
, "Math.atan2(Infinity,-0)", Math
.PI
/2, Math
.atan2(Number
.POSITIVE_INFINITY
,-0) );
80 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-Infinity, 0)", -Math
.PI
/2, Math
.atan2(Number
.NEGATIVE_INFINITY
, 0) );
81 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-Infinity,-0)", -Math
.PI
/2, Math
.atan2(Number
.NEGATIVE_INFINITY
,-0) );
82 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-Infinity, 1)", -Math
.PI
/2, Math
.atan2(Number
.NEGATIVE_INFINITY
, 1) );
83 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-Infinity, -1)", -Math
.PI
/2, Math
.atan2(Number
.NEGATIVE_INFINITY
,-1) );
84 array
[item
++] = new TestCase( SECTION
, "Math.atan2(Infinity, Infinity)", Math
.PI
/4, Math
.atan2(Number
.POSITIVE_INFINITY
, Number
.POSITIVE_INFINITY
) );
85 array
[item
++] = new TestCase( SECTION
, "Math.atan2(Infinity, -Infinity)", 3*Math
.PI
/4, Math
.atan2(Number
.POSITIVE_INFINITY
, Number
.NEGATIVE_INFINITY
) );
86 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-Infinity, Infinity)", -Math
.PI
/4, Math
.atan2(Number
.NEGATIVE_INFINITY
, Number
.POSITIVE_INFINITY
) );
87 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-Infinity, -Infinity)", -3*Math
.PI
/4, Math
.atan2(Number
.NEGATIVE_INFINITY
, Number
.NEGATIVE_INFINITY
) );
88 array
[item
++] = new TestCase( SECTION
, "Math.atan2(-1, 1)", -Math
.PI
/4, Math
.atan2( -1, 1) );
94 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
95 testcases
[tc
].passed
= writeTestCaseResult(
98 testcases
[tc
].description
+" = "+
99 testcases
[tc
].actual
);
101 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";
104 return ( testcases
);