js/src/tests/ecma/Math/15.8.2.2.js

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

mercurial