Debian Codegraph @

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