Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
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 */
24 var SECTION = "15.8.2.12";
25 var VERSION = "ECMA_1";
26 var TITLE = "Math.min(x, y)";
27 var BUGNUMBER="76439";
29 startTest();
31 writeHeaderToLog( SECTION + " "+ TITLE);
33 new TestCase( SECTION,
34 "Math.min.length",
35 2,
36 Math.min.length );
38 new TestCase( SECTION,
39 "Math.min()",
40 Infinity,
41 Math.min() );
43 new TestCase( SECTION,
44 "Math.min(void 0, 1)",
45 Number.NaN,
46 Math.min( void 0, 1 ) );
48 new TestCase( SECTION,
49 "Math.min(void 0, void 0)",
50 Number.NaN,
51 Math.min( void 0, void 0 ) );
53 new TestCase( SECTION,
54 "Math.min(null, 1)",
55 0,
56 Math.min( null, 1 ) );
58 new TestCase( SECTION,
59 "Math.min(-1, null)",
60 -1,
61 Math.min( -1, null ) );
63 new TestCase( SECTION,
64 "Math.min(true, false)",
65 0,
66 Math.min(true,false) );
68 new TestCase( SECTION,
69 "Math.min('-99','99')",
70 -99,
71 Math.min( "-99","99") );
73 new TestCase( SECTION,
74 "Math.min(NaN,0)",
75 Number.NaN,
76 Math.min(Number.NaN,0) );
78 new TestCase( SECTION,
79 "Math.min(NaN,1)",
80 Number.NaN,
81 Math.min(Number.NaN,1) );
83 new TestCase( SECTION,
84 "Math.min(NaN,-1)",
85 Number.NaN,
86 Math.min(Number.NaN,-1) );
88 new TestCase( SECTION,
89 "Math.min(0,NaN)",
90 Number.NaN,
91 Math.min(0,Number.NaN) );
93 new TestCase( SECTION,
94 "Math.min(1,NaN)",
95 Number.NaN,
96 Math.min(1,Number.NaN) );
98 new TestCase( SECTION,
99 "Math.min(-1,NaN)",
100 Number.NaN,
101 Math.min(-1,Number.NaN) );
103 new TestCase( SECTION,
104 "Math.min(NaN,NaN)",
105 Number.NaN,
106 Math.min(Number.NaN,Number.NaN) );
108 new TestCase( SECTION,
109 "Math.min(1,1.0000000001)",
110 1,
111 Math.min(1,1.0000000001) );
113 new TestCase( SECTION,
114 "Math.min(1.0000000001,1)",
115 1,
116 Math.min(1.0000000001,1) );
118 new TestCase( SECTION,
119 "Math.min(0,0)",
120 0,
121 Math.min(0,0) );
123 new TestCase( SECTION,
124 "Math.min(0,-0)",
125 -0,
126 Math.min(0,-0) );
128 new TestCase( SECTION,
129 "Math.min(-0,-0)",
130 -0,
131 Math.min(-0,-0) );
133 new TestCase( SECTION,
134 "Infinity/Math.min(0,-0)",
135 -Infinity,
136 Infinity/Math.min(0,-0) );
138 new TestCase( SECTION,
139 "Infinity/Math.min(-0,-0)",
140 -Infinity,
141 Infinity/Math.min(-0,-0) );
143 test();