js/src/tests/ecma/Math/15.8.2.12.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 15.8.2.12.js
michael@0 9 ECMA Section: 15.8.2.12 Math.min(x, y)
michael@0 10 Description: return the smaller of the two arguments.
michael@0 11 special cases:
michael@0 12 - if x is NaN or y is NaN return NaN
michael@0 13 - if x < y return x
michael@0 14 - if y > x return y
michael@0 15 - if x is +0 and y is +0 return +0
michael@0 16 - if x is +0 and y is -0 return -0
michael@0 17 - if x is -0 and y is +0 return -0
michael@0 18 - if x is -0 and y is -0 return -0
michael@0 19 Author: christine@netscape.com
michael@0 20 Date: 7 july 1997
michael@0 21 */
michael@0 22
michael@0 23
michael@0 24 var SECTION = "15.8.2.12";
michael@0 25 var VERSION = "ECMA_1";
michael@0 26 var TITLE = "Math.min(x, y)";
michael@0 27 var BUGNUMBER="76439";
michael@0 28
michael@0 29 startTest();
michael@0 30
michael@0 31 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 32
michael@0 33 new TestCase( SECTION,
michael@0 34 "Math.min.length",
michael@0 35 2,
michael@0 36 Math.min.length );
michael@0 37
michael@0 38 new TestCase( SECTION,
michael@0 39 "Math.min()",
michael@0 40 Infinity,
michael@0 41 Math.min() );
michael@0 42
michael@0 43 new TestCase( SECTION,
michael@0 44 "Math.min(void 0, 1)",
michael@0 45 Number.NaN,
michael@0 46 Math.min( void 0, 1 ) );
michael@0 47
michael@0 48 new TestCase( SECTION,
michael@0 49 "Math.min(void 0, void 0)",
michael@0 50 Number.NaN,
michael@0 51 Math.min( void 0, void 0 ) );
michael@0 52
michael@0 53 new TestCase( SECTION,
michael@0 54 "Math.min(null, 1)",
michael@0 55 0,
michael@0 56 Math.min( null, 1 ) );
michael@0 57
michael@0 58 new TestCase( SECTION,
michael@0 59 "Math.min(-1, null)",
michael@0 60 -1,
michael@0 61 Math.min( -1, null ) );
michael@0 62
michael@0 63 new TestCase( SECTION,
michael@0 64 "Math.min(true, false)",
michael@0 65 0,
michael@0 66 Math.min(true,false) );
michael@0 67
michael@0 68 new TestCase( SECTION,
michael@0 69 "Math.min('-99','99')",
michael@0 70 -99,
michael@0 71 Math.min( "-99","99") );
michael@0 72
michael@0 73 new TestCase( SECTION,
michael@0 74 "Math.min(NaN,0)",
michael@0 75 Number.NaN,
michael@0 76 Math.min(Number.NaN,0) );
michael@0 77
michael@0 78 new TestCase( SECTION,
michael@0 79 "Math.min(NaN,1)",
michael@0 80 Number.NaN,
michael@0 81 Math.min(Number.NaN,1) );
michael@0 82
michael@0 83 new TestCase( SECTION,
michael@0 84 "Math.min(NaN,-1)",
michael@0 85 Number.NaN,
michael@0 86 Math.min(Number.NaN,-1) );
michael@0 87
michael@0 88 new TestCase( SECTION,
michael@0 89 "Math.min(0,NaN)",
michael@0 90 Number.NaN,
michael@0 91 Math.min(0,Number.NaN) );
michael@0 92
michael@0 93 new TestCase( SECTION,
michael@0 94 "Math.min(1,NaN)",
michael@0 95 Number.NaN,
michael@0 96 Math.min(1,Number.NaN) );
michael@0 97
michael@0 98 new TestCase( SECTION,
michael@0 99 "Math.min(-1,NaN)",
michael@0 100 Number.NaN,
michael@0 101 Math.min(-1,Number.NaN) );
michael@0 102
michael@0 103 new TestCase( SECTION,
michael@0 104 "Math.min(NaN,NaN)",
michael@0 105 Number.NaN,
michael@0 106 Math.min(Number.NaN,Number.NaN) );
michael@0 107
michael@0 108 new TestCase( SECTION,
michael@0 109 "Math.min(1,1.0000000001)",
michael@0 110 1,
michael@0 111 Math.min(1,1.0000000001) );
michael@0 112
michael@0 113 new TestCase( SECTION,
michael@0 114 "Math.min(1.0000000001,1)",
michael@0 115 1,
michael@0 116 Math.min(1.0000000001,1) );
michael@0 117
michael@0 118 new TestCase( SECTION,
michael@0 119 "Math.min(0,0)",
michael@0 120 0,
michael@0 121 Math.min(0,0) );
michael@0 122
michael@0 123 new TestCase( SECTION,
michael@0 124 "Math.min(0,-0)",
michael@0 125 -0,
michael@0 126 Math.min(0,-0) );
michael@0 127
michael@0 128 new TestCase( SECTION,
michael@0 129 "Math.min(-0,-0)",
michael@0 130 -0,
michael@0 131 Math.min(-0,-0) );
michael@0 132
michael@0 133 new TestCase( SECTION,
michael@0 134 "Infinity/Math.min(0,-0)",
michael@0 135 -Infinity,
michael@0 136 Infinity/Math.min(0,-0) );
michael@0 137
michael@0 138 new TestCase( SECTION,
michael@0 139 "Infinity/Math.min(-0,-0)",
michael@0 140 -Infinity,
michael@0 141 Infinity/Math.min(-0,-0) );
michael@0 142
michael@0 143 test();

mercurial