]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Math/15.8.2.12.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.8.2.12.js
24 ECMA Section: 15.8.2.12 Math.min(x, y)
25 Description: return the smaller of the two arguments.
27 - if x is NaN or y is NaN return NaN
30 - if x is +0 and y is +0 return +0
31 - if x is +0 and y is -0 return -0
32 - if x is -0 and y is +0 return -0
33 - if x is -0 and y is -0 return -0
34 Author: christine@netscape.com
39 var SECTION
= "15.8.2.12";
40 var VERSION
= "ECMA_1";
42 var TITLE
= "Math.min(x, y)";
43 var BUGNUMBER
="76439";
45 writeHeaderToLog( SECTION
+ " "+ TITLE
);
47 var testcases
= getTestCases();
50 function getTestCases() {
51 var array
= new Array();
54 array
[item
++] = new TestCase( SECTION
, "Math.min.length", 2, Math
.min
.length
);
56 array
[item
++] = new TestCase( SECTION
, "Math.min()", Infinity
, Math
.min() );
57 array
[item
++] = new TestCase( SECTION
, "Math.min(void 0, 1)", Number
.NaN
, Math
.min( void 0, 1 ) );
58 array
[item
++] = new TestCase( SECTION
, "Math.min(void 0, void 0)", Number
.NaN
, Math
.min( void 0, void 0 ) );
59 array
[item
++] = new TestCase( SECTION
, "Math.min(null, 1)", 0, Math
.min( null, 1 ) );
60 array
[item
++] = new TestCase( SECTION
, "Math.min(-1, null)", -1, Math
.min( -1, null ) );
61 array
[item
++] = new TestCase( SECTION
, "Math.min(true, false)", 0, Math
.min(true,false) );
63 array
[item
++] = new TestCase( SECTION
, "Math.min('-99','99')", -99, Math
.min( "-99","99") );
65 array
[item
++] = new TestCase( SECTION
, "Math.min(NaN,0)", Number
.NaN
, Math
.min(Number
.NaN
,0) );
66 array
[item
++] = new TestCase( SECTION
, "Math.min(NaN,1)", Number
.NaN
, Math
.min(Number
.NaN
,1) );
67 array
[item
++] = new TestCase( SECTION
, "Math.min(NaN,-1)", Number
.NaN
, Math
.min(Number
.NaN
,-1) );
68 array
[item
++] = new TestCase( SECTION
, "Math.min(0,NaN)", Number
.NaN
, Math
.min(0,Number
.NaN
) );
69 array
[item
++] = new TestCase( SECTION
, "Math.min(1,NaN)", Number
.NaN
, Math
.min(1,Number
.NaN
) );
70 array
[item
++] = new TestCase( SECTION
, "Math.min(-1,NaN)", Number
.NaN
, Math
.min(-1,Number
.NaN
) );
71 array
[item
++] = new TestCase( SECTION
, "Math.min(NaN,NaN)", Number
.NaN
, Math
.min(Number
.NaN
,Number
.NaN
) );
72 array
[item
++] = new TestCase( SECTION
, "Math.min(1,1.0000000001)", 1, Math
.min(1,1.0000000001) );
73 array
[item
++] = new TestCase( SECTION
, "Math.min(1.0000000001,1)", 1, Math
.min(1.0000000001,1) );
74 array
[item
++] = new TestCase( SECTION
, "Math.min(0,0)", 0, Math
.min(0,0) );
75 array
[item
++] = new TestCase( SECTION
, "Math.min(0,-0)", -0, Math
.min(0,-0) );
76 array
[item
++] = new TestCase( SECTION
, "Math.min(-0,-0)", -0, Math
.min(-0,-0) );
78 array
[item
++] = new TestCase( SECTION
, "Infinity/Math.min(0,-0)", -Infinity
, Infinity
/Math
.min(0,-0) );
79 array
[item
++] = new TestCase( SECTION
, "Infinity/Math.min(-0,-0)", -Infinity
, Infinity
/Math
.min(-0,-0) );
85 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
86 testcases
[tc
].passed
= writeTestCaseResult(
89 testcases
[tc
].description
+" = "+
90 testcases
[tc
].actual
);
92 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";