Debian Codegraph @

rhino/testsrc/tests/ecma/Math/15.8.2.4.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.4.js';
7
8 /**
9 File Name: 15.8.2.4.js
10 ECMA Section: 15.8.2.4 atan( x )
11 Description: return an approximation to the arc tangent 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 == +0, the result is +0
16 - if x == -0, the result is -0
17 - if x == +Infinity, the result is approximately +PI/2
18 - if x == -Infinity, the result is approximately -PI/2
19 Author: [email protected]
20 Date: 7 july 1997
21
22 */
23
24 var SECTION = "15.8.2.4";
25 var VERSION = "ECMA_1";
26 var TITLE = "Math.atan()";
27 var BUGNUMBER="77391";
28
29 startTest();
30
31 writeHeaderToLog( SECTION + " "+ TITLE);
32
33 new TestCase( SECTION,
34 "Math.atan.length",
35 1,
36 Math.atan.length );
37
38 new TestCase( SECTION,
39 "Math.atan()",
40 Number.NaN,
41 Math.atan() );
42
43 new TestCase( SECTION,
44 "Math.atan(void 0)",
45 Number.NaN,
46 Math.atan(void 0) );
47
48 new TestCase( SECTION,
49 "Math.atan(null)",
50 0,
51 Math.atan(null) );
52
53 new TestCase( SECTION,
54 "Math.atan(NaN)",
55 Number.NaN,
56 Math.atan(Number.NaN) );
57
58 new TestCase( SECTION,
59 "Math.atan('a string')",
60 Number.NaN,
61 Math.atan("a string") );
62
63 new TestCase( SECTION,
64 "Math.atan('0')",
65 0,
66 Math.atan('0') );
67
68 new TestCase( SECTION,
69 "Math.atan('1')",
70 Math.PI/4,
71 Math.atan('1') );
72
73 new TestCase( SECTION,
74 "Math.atan('-1')",
75 -Math.PI/4,
76 Math.atan('-1') );
77
78 new TestCase( SECTION,
79 "Math.atan('Infinity)",
80 Math.PI/2,
81 Math.atan('Infinity') );
82
83 new TestCase( SECTION,
84 "Math.atan('-Infinity)",
85 -Math.PI/2,
86 Math.atan('-Infinity') );
87
88 new TestCase( SECTION,
89 "Math.atan(0)",
90 0,
91 Math.atan(0) );
92
93 new TestCase( SECTION,
94 "Math.atan(-0)",
95 -0,
96 Math.atan(-0) );
97
98 new TestCase( SECTION,
99 "Infinity/Math.atan(-0)",
100 -Infinity,
101 Infinity/Math.atan(-0) );
102
103 new TestCase( SECTION,
104 "Math.atan(Infinity)",
105 Math.PI/2,
106 Math.atan(Number.POSITIVE_INFINITY) );
107
108 new TestCase( SECTION,
109 "Math.atan(-Infinity)",
110 -Math.PI/2,
111 Math.atan(Number.NEGATIVE_INFINITY) );
112
113 new TestCase( SECTION,
114 "Math.atan(1)",
115 Math.PI/4,
116 Math.atan(1) );
117
118 new TestCase( SECTION,
119 "Math.atan(-1)",
120 -Math.PI/4,
121 Math.atan(-1) );
122
123 test();