]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Math/15.8.2.3.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.3.js
24 ECMA Section: 15.8.2.3 asin( x )
25 Description: return an approximation to the arc sine 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 > 1, the result is NaN
30 - if x < -1, the result is NaN
31 - if x == +0, the result is +0
32 - if x == -0, the result is -0
33 Author: christine@netscape.com
37 var SECTION
= "15.8.2.3";
38 var VERSION
= "ECMA_1";
40 var TITLE
= "Math.asin()";
42 writeHeaderToLog( SECTION
+ " "+ TITLE
);
44 var testcases
= getTestCases();
47 function getTestCases() {
48 var array
= new Array();
51 array
[item
++] = new TestCase( SECTION
, "Math.asin()", Number
.NaN
, Math
.asin() );
52 array
[item
++] = new TestCase( SECTION
, "Math.asin(void 0)", Number
.NaN
, Math
.asin(void 0) );
53 array
[item
++] = new TestCase( SECTION
, "Math.asin(null)", 0, Math
.asin(null) );
54 array
[item
++] = new TestCase( SECTION
, "Math.asin(NaN)", Number
.NaN
, Math
.asin(Number
.NaN
) );
56 array
[item
++] = new TestCase( SECTION
, "Math.asin('string')", Number
.NaN
, Math
.asin("string") );
57 array
[item
++] = new TestCase( SECTION
, "Math.asin('0')", 0, Math
.asin("0") );
58 array
[item
++] = new TestCase( SECTION
, "Math.asin('1')", Math
.PI
/2, Math
.asin("1") );
59 array
[item
++] = new TestCase( SECTION
, "Math.asin('-1')", -Math
.PI
/2, Math
.asin("-1") );
60 array
[item
++] = new TestCase( SECTION
, "Math.asin(Math.SQRT1_2+'')", Math
.PI
/4, Math
.asin(Math
.SQRT1_2
+'') );
61 array
[item
++] = new TestCase( SECTION
, "Math.asin(-Math.SQRT1_2+'')", -Math
.PI
/4, Math
.asin(-Math
.SQRT1_2
+'') );
63 array
[item
++] = new TestCase( SECTION
, "Math.asin(1.000001)", Number
.NaN
, Math
.asin(1.000001) );
64 array
[item
++] = new TestCase( SECTION
, "Math.asin(-1.000001)", Number
.NaN
, Math
.asin(-1.000001) );
65 array
[item
++] = new TestCase( SECTION
, "Math.asin(0)", 0, Math
.asin(0) );
66 array
[item
++] = new TestCase( SECTION
, "Math.asin(-0)", -0, Math
.asin(-0) );
68 array
[item
++] = new TestCase( SECTION
, "Infinity/Math.asin(-0)", -Infinity
, Infinity
/Math
.asin(-0) );
70 array
[item
++] = new TestCase( SECTION
, "Math.asin(1)", Math
.PI
/2, Math
.asin(1) );
71 array
[item
++] = new TestCase( SECTION
, "Math.asin(-1)", -Math
.PI
/2, Math
.asin(-1) );
72 array
[item
++] = new TestCase( SECTION
, "Math.asin(Math.SQRT1_2))", Math
.PI
/4, Math
.asin(Math
.SQRT1_2
) );
73 array
[item
++] = new TestCase( SECTION
, "Math.asin(-Math.SQRT1_2))", -Math
.PI
/4, Math
.asin(-Math
.SQRT1_2
));
79 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
80 testcases
[tc
].passed
= writeTestCaseResult(
83 testcases
[tc
].description
+" = "+
84 testcases
[tc
].actual
);
86 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";