michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 15.8.2.12.js michael@0: ECMA Section: 15.8.2.12 Math.min(x, y) michael@0: Description: return the smaller of the two arguments. michael@0: special cases: michael@0: - if x is NaN or y is NaN return NaN michael@0: - if x < y return x michael@0: - if y > x return y michael@0: - if x is +0 and y is +0 return +0 michael@0: - if x is +0 and y is -0 return -0 michael@0: - if x is -0 and y is +0 return -0 michael@0: - if x is -0 and y is -0 return -0 michael@0: Author: christine@netscape.com michael@0: Date: 7 july 1997 michael@0: */ michael@0: michael@0: michael@0: var SECTION = "15.8.2.12"; michael@0: var VERSION = "ECMA_1"; michael@0: var TITLE = "Math.min(x, y)"; michael@0: var BUGNUMBER="76439"; michael@0: michael@0: startTest(); michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min.length", michael@0: 2, michael@0: Math.min.length ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min()", michael@0: Infinity, michael@0: Math.min() ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(void 0, 1)", michael@0: Number.NaN, michael@0: Math.min( void 0, 1 ) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(void 0, void 0)", michael@0: Number.NaN, michael@0: Math.min( void 0, void 0 ) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(null, 1)", michael@0: 0, michael@0: Math.min( null, 1 ) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(-1, null)", michael@0: -1, michael@0: Math.min( -1, null ) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(true, false)", michael@0: 0, michael@0: Math.min(true,false) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min('-99','99')", michael@0: -99, michael@0: Math.min( "-99","99") ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(NaN,0)", michael@0: Number.NaN, michael@0: Math.min(Number.NaN,0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(NaN,1)", michael@0: Number.NaN, michael@0: Math.min(Number.NaN,1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(NaN,-1)", michael@0: Number.NaN, michael@0: Math.min(Number.NaN,-1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(0,NaN)", michael@0: Number.NaN, michael@0: Math.min(0,Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(1,NaN)", michael@0: Number.NaN, michael@0: Math.min(1,Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(-1,NaN)", michael@0: Number.NaN, michael@0: Math.min(-1,Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(NaN,NaN)", michael@0: Number.NaN, michael@0: Math.min(Number.NaN,Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(1,1.0000000001)", michael@0: 1, michael@0: Math.min(1,1.0000000001) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(1.0000000001,1)", michael@0: 1, michael@0: Math.min(1.0000000001,1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(0,0)", michael@0: 0, michael@0: Math.min(0,0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(0,-0)", michael@0: -0, michael@0: Math.min(0,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.min(-0,-0)", michael@0: -0, michael@0: Math.min(-0,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Infinity/Math.min(0,-0)", michael@0: -Infinity, michael@0: Infinity/Math.min(0,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Infinity/Math.min(-0,-0)", michael@0: -Infinity, michael@0: Infinity/Math.min(-0,-0) ); michael@0: michael@0: test();