Debian Codegraph @

rhino/testsrc/tests/ecma/Math/15.8.2.11.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.11.js';
7
8 /**
9 File Name: 15.8.2.11.js
10 ECMA Section: 15.8.2.11 Math.max(x, y)
11 Description: return the smaller of the two arguments.
12 special cases:
13 - if x is NaN or y is NaN return NaN
14 - if x < y return x
15 - if y > x return y
16 - if x is +0 and y is +0 return +0
17 - if x is +0 and y is -0 return -0
18 - if x is -0 and y is +0 return -0
19 - if x is -0 and y is -0 return -0
20 Author: [email protected]
21 Date: 7 july 1997
22 */
23
24 var SECTION = "15.8.2.11";
25 var VERSION = "ECMA_1";
26 var TITLE = "Math.max(x, y)";
27 var BUGNUMBER="76439";
28
29 startTest();
30
31 writeHeaderToLog( SECTION + " "+ TITLE);
32
33 new TestCase( SECTION,
34 "Math.max.length",
35 2,
36 Math.max.length );
37
38 new TestCase( SECTION,
39 "Math.max()",
40 -Infinity,
41 Math.max() );
42
43 new TestCase( SECTION,
44 "Math.max(void 0, 1)",
45 Number.NaN,
46 Math.max( void 0, 1 ) );
47
48 new TestCase( SECTION,
49 "Math.max(void 0, void 0)",
50 Number.NaN,
51 Math.max( void 0, void 0 ) );
52
53 new TestCase( SECTION,
54 "Math.max(null, 1)",
55 1,
56 Math.max( null, 1 ) );
57
58 new TestCase( SECTION,
59 "Math.max(-1, null)",
60 0,
61 Math.max( -1, null ) );
62
63 new TestCase( SECTION,
64 "Math.max(true, false)",
65 1,
66 Math.max(true,false) );
67
68 new TestCase( SECTION,
69 "Math.max('-99','99')",
70 99,
71 Math.max( "-99","99") );
72
73 new TestCase( SECTION,
74 "Math.max(NaN, Infinity)",
75 Number.NaN,
76 Math.max(Number.NaN,Number.POSITIVE_INFINITY) );
77
78 new TestCase( SECTION,
79 "Math.max(NaN, 0)",
80 Number.NaN,
81 Math.max(Number.NaN, 0) );
82
83 new TestCase( SECTION,
84 "Math.max('a string', 0)",
85 Number.NaN,
86 Math.max("a string", 0) );
87
88 new TestCase( SECTION,
89 "Math.max(NaN, 1)",
90 Number.NaN,
91 Math.max(Number.NaN,1) );
92
93 new TestCase( SECTION,
94 "Math.max('a string',Infinity)",
95 Number.NaN,
96 Math.max("a string", Number.POSITIVE_INFINITY) );
97
98 new TestCase( SECTION,
99 "Math.max(Infinity, NaN)",
100 Number.NaN,
101 Math.max( Number.POSITIVE_INFINITY, Number.NaN) );
102
103 new TestCase( SECTION,
104 "Math.max(NaN, NaN)",
105 Number.NaN,
106 Math.max(Number.NaN, Number.NaN) );
107
108 new TestCase( SECTION,
109 "Math.max(0,NaN)",
110 Number.NaN,
111 Math.max(0,Number.NaN) );
112
113 new TestCase( SECTION,
114 "Math.max(1, NaN)",
115 Number.NaN,
116 Math.max(1, Number.NaN) );
117
118 new TestCase( SECTION,
119 "Math.max(0,0)",
120 0,
121 Math.max(0,0) );
122
123 new TestCase( SECTION,
124 "Math.max(0,-0)",
125 0,
126 Math.max(0,-0) );
127
128 new TestCase( SECTION,
129 "Math.max(-0,0)",
130 0,
131 Math.max(-0,0) );
132
133 new TestCase( SECTION,
134 "Math.max(-0,-0)",
135 -0,
136 Math.max(-0,-0) );
137
138 new TestCase( SECTION,
139 "Infinity/Math.max(-0,-0)",
140 -Infinity,
141 Infinity/Math.max(-0,-0) );
142
143 new TestCase( SECTION,
144 "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY,
145 Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) );
146
147 new TestCase( SECTION,
148 "Math.max(Infinity, Infinity)",
149 Number.POSITIVE_INFINITY,
150 Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) );
151
152 new TestCase( SECTION,
153 "Math.max(-Infinity,-Infinity)",
154 Number.NEGATIVE_INFINITY,
155 Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) );
156
157 new TestCase( SECTION,
158 "Math.max(1,.99999999999999)",
159 1,
160 Math.max(1,.99999999999999) );
161
162 new TestCase( SECTION,
163 "Math.max(-1,-.99999999999999)",
164 -.99999999999999,
165 Math.max(-1,-.99999999999999) );
166
167 test();