Debian Codegraph @

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