|
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.12.js |
|
9 ECMA Section: 15.8.2.12 Math.min(x, y) |
|
10 Description: return the smaller of the two arguments. |
|
11 special cases: |
|
12 - if x is NaN or y is NaN return NaN |
|
13 - if x < y return x |
|
14 - if y > x return y |
|
15 - if x is +0 and y is +0 return +0 |
|
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 Author: christine@netscape.com |
|
20 Date: 7 july 1997 |
|
21 */ |
|
22 |
|
23 |
|
24 var SECTION = "15.8.2.12"; |
|
25 var VERSION = "ECMA_1"; |
|
26 var TITLE = "Math.min(x, y)"; |
|
27 var BUGNUMBER="76439"; |
|
28 |
|
29 startTest(); |
|
30 |
|
31 writeHeaderToLog( SECTION + " "+ TITLE); |
|
32 |
|
33 new TestCase( SECTION, |
|
34 "Math.min.length", |
|
35 2, |
|
36 Math.min.length ); |
|
37 |
|
38 new TestCase( SECTION, |
|
39 "Math.min()", |
|
40 Infinity, |
|
41 Math.min() ); |
|
42 |
|
43 new TestCase( SECTION, |
|
44 "Math.min(void 0, 1)", |
|
45 Number.NaN, |
|
46 Math.min( void 0, 1 ) ); |
|
47 |
|
48 new TestCase( SECTION, |
|
49 "Math.min(void 0, void 0)", |
|
50 Number.NaN, |
|
51 Math.min( void 0, void 0 ) ); |
|
52 |
|
53 new TestCase( SECTION, |
|
54 "Math.min(null, 1)", |
|
55 0, |
|
56 Math.min( null, 1 ) ); |
|
57 |
|
58 new TestCase( SECTION, |
|
59 "Math.min(-1, null)", |
|
60 -1, |
|
61 Math.min( -1, null ) ); |
|
62 |
|
63 new TestCase( SECTION, |
|
64 "Math.min(true, false)", |
|
65 0, |
|
66 Math.min(true,false) ); |
|
67 |
|
68 new TestCase( SECTION, |
|
69 "Math.min('-99','99')", |
|
70 -99, |
|
71 Math.min( "-99","99") ); |
|
72 |
|
73 new TestCase( SECTION, |
|
74 "Math.min(NaN,0)", |
|
75 Number.NaN, |
|
76 Math.min(Number.NaN,0) ); |
|
77 |
|
78 new TestCase( SECTION, |
|
79 "Math.min(NaN,1)", |
|
80 Number.NaN, |
|
81 Math.min(Number.NaN,1) ); |
|
82 |
|
83 new TestCase( SECTION, |
|
84 "Math.min(NaN,-1)", |
|
85 Number.NaN, |
|
86 Math.min(Number.NaN,-1) ); |
|
87 |
|
88 new TestCase( SECTION, |
|
89 "Math.min(0,NaN)", |
|
90 Number.NaN, |
|
91 Math.min(0,Number.NaN) ); |
|
92 |
|
93 new TestCase( SECTION, |
|
94 "Math.min(1,NaN)", |
|
95 Number.NaN, |
|
96 Math.min(1,Number.NaN) ); |
|
97 |
|
98 new TestCase( SECTION, |
|
99 "Math.min(-1,NaN)", |
|
100 Number.NaN, |
|
101 Math.min(-1,Number.NaN) ); |
|
102 |
|
103 new TestCase( SECTION, |
|
104 "Math.min(NaN,NaN)", |
|
105 Number.NaN, |
|
106 Math.min(Number.NaN,Number.NaN) ); |
|
107 |
|
108 new TestCase( SECTION, |
|
109 "Math.min(1,1.0000000001)", |
|
110 1, |
|
111 Math.min(1,1.0000000001) ); |
|
112 |
|
113 new TestCase( SECTION, |
|
114 "Math.min(1.0000000001,1)", |
|
115 1, |
|
116 Math.min(1.0000000001,1) ); |
|
117 |
|
118 new TestCase( SECTION, |
|
119 "Math.min(0,0)", |
|
120 0, |
|
121 Math.min(0,0) ); |
|
122 |
|
123 new TestCase( SECTION, |
|
124 "Math.min(0,-0)", |
|
125 -0, |
|
126 Math.min(0,-0) ); |
|
127 |
|
128 new TestCase( SECTION, |
|
129 "Math.min(-0,-0)", |
|
130 -0, |
|
131 Math.min(-0,-0) ); |
|
132 |
|
133 new TestCase( SECTION, |
|
134 "Infinity/Math.min(0,-0)", |
|
135 -Infinity, |
|
136 Infinity/Math.min(0,-0) ); |
|
137 |
|
138 new TestCase( SECTION, |
|
139 "Infinity/Math.min(-0,-0)", |
|
140 -Infinity, |
|
141 Infinity/Math.min(-0,-0) ); |
|
142 |
|
143 test(); |