Debian Codegraph @

rhino/testsrc/tests/ecma/Math/15.8.2.3.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '15.8.2.3.js';
7
8 /**
9 File Name: 15.8.2.3.js
10 ECMA Section: 15.8.2.3 asin( x )
11 Description: return an approximation to the arc sine of the
12 argument. the result is expressed in radians and
13 range is from -PI/2 to +PI/2. special cases:
14 - if x is NaN, the result is NaN
15 - if x > 1, the result is NaN
16 - if x < -1, the result is NaN
17 - if x == +0, the result is +0
18 - if x == -0, the result is -0
19 Author: [email protected]
20 Date: 7 july 1997
21
22 */
23 var SECTION = "15.8.2.3";
24 var VERSION = "ECMA_1";
25 startTest();
26 var TITLE = "Math.asin()";
27
28 writeHeaderToLog( SECTION + " "+ TITLE);
29
30 new TestCase( SECTION,
31 "Math.asin()",
32 Number.NaN,
33 Math.asin() );
34
35 new TestCase( SECTION,
36 "Math.asin(void 0)",
37 Number.NaN,
38 Math.asin(void 0) );
39
40 new TestCase( SECTION,
41 "Math.asin(null)",
42 0,
43 Math.asin(null) );
44
45 new TestCase( SECTION,
46 "Math.asin(NaN)",
47 Number.NaN,
48 Math.asin(Number.NaN) );
49
50 new TestCase( SECTION,
51 "Math.asin('string')",
52 Number.NaN,
53 Math.asin("string") );
54
55 new TestCase( SECTION,
56 "Math.asin('0')",
57 0,
58 Math.asin("0") );
59
60 new TestCase( SECTION,
61 "Math.asin('1')",
62 Math.PI/2,
63 Math.asin("1") );
64
65 new TestCase( SECTION,
66 "Math.asin('-1')",
67 -Math.PI/2,
68 Math.asin("-1") );
69
70 new TestCase( SECTION,
71 "Math.asin(Math.SQRT1_2+'')",
72 Math.PI/4,
73 Math.asin(Math.SQRT1_2+'') );
74
75 new TestCase( SECTION,
76 "Math.asin(-Math.SQRT1_2+'')",
77 -Math.PI/4,
78 Math.asin(-Math.SQRT1_2+'') );
79
80 new TestCase( SECTION,
81 "Math.asin(1.000001)",
82 Number.NaN,
83 Math.asin(1.000001) );
84
85 new TestCase( SECTION,
86 "Math.asin(-1.000001)",
87 Number.NaN,
88 Math.asin(-1.000001) );
89
90 new TestCase( SECTION,
91 "Math.asin(0)",
92 0,
93 Math.asin(0) );
94
95 new TestCase( SECTION,
96 "Math.asin(-0)",
97 -0,
98 Math.asin(-0) );
99
100 new TestCase( SECTION,
101 "Infinity/Math.asin(-0)",
102 -Infinity,
103 Infinity/Math.asin(-0) );
104
105 new TestCase( SECTION,
106 "Math.asin(1)",
107 Math.PI/2,
108 Math.asin(1) );
109
110 new TestCase( SECTION,
111 "Math.asin(-1)",
112 -Math.PI/2,
113 Math.asin(-1) );
114
115 new TestCase( SECTION,
116 "Math.asin(Math.SQRT1_2))",
117 Math.PI/4,
118 Math.asin(Math.SQRT1_2) );
119
120 new TestCase( SECTION,
121 "Math.asin(-Math.SQRT1_2))",
122 -Math.PI/4,
123 Math.asin(-Math.SQRT1_2));
124
125 test();