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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Math/15.8.2.12.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,143 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          15.8.2.12.js
    1.12 +   ECMA Section:       15.8.2.12 Math.min(x, y)
    1.13 +   Description:        return the smaller of the two arguments.
    1.14 +   special cases:
    1.15 +   - if x is NaN or y is NaN   return NaN
    1.16 +   - if x < y                  return x
    1.17 +   - if y > x                  return y
    1.18 +   - if x is +0 and y is +0    return +0
    1.19 +   - if x is +0 and y is -0    return -0
    1.20 +   - if x is -0 and y is +0    return -0
    1.21 +   - if x is -0 and y is -0    return -0
    1.22 +   Author:             christine@netscape.com
    1.23 +   Date:               7 july 1997
    1.24 +*/
    1.25 +
    1.26 +
    1.27 +var SECTION = "15.8.2.12";
    1.28 +var VERSION = "ECMA_1";
    1.29 +var TITLE   = "Math.min(x, y)";
    1.30 +var BUGNUMBER="76439";
    1.31 +
    1.32 +startTest();
    1.33 +
    1.34 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.35 +
    1.36 +new TestCase( SECTION,
    1.37 +	      "Math.min.length",
    1.38 +	      2,
    1.39 +	      Math.min.length );
    1.40 +
    1.41 +new TestCase( SECTION,
    1.42 +	      "Math.min()",
    1.43 +	      Infinity,
    1.44 +	      Math.min() );
    1.45 +
    1.46 +new TestCase( SECTION,
    1.47 +	      "Math.min(void 0, 1)",
    1.48 +	      Number.NaN,
    1.49 +	      Math.min( void 0, 1 ) );
    1.50 +
    1.51 +new TestCase( SECTION,
    1.52 +	      "Math.min(void 0, void 0)",
    1.53 +	      Number.NaN,
    1.54 +	      Math.min( void 0, void 0 ) );
    1.55 +
    1.56 +new TestCase( SECTION,
    1.57 +	      "Math.min(null, 1)",
    1.58 +	      0,
    1.59 +	      Math.min( null, 1 ) );
    1.60 +
    1.61 +new TestCase( SECTION,
    1.62 +	      "Math.min(-1, null)",
    1.63 +	      -1,
    1.64 +	      Math.min( -1, null ) );
    1.65 +
    1.66 +new TestCase( SECTION,
    1.67 +	      "Math.min(true, false)",
    1.68 +	      0,
    1.69 +	      Math.min(true,false) );
    1.70 +
    1.71 +new TestCase( SECTION,
    1.72 +	      "Math.min('-99','99')",
    1.73 +	      -99,
    1.74 +	      Math.min( "-99","99") );
    1.75 +
    1.76 +new TestCase( SECTION,
    1.77 +	      "Math.min(NaN,0)",
    1.78 +	      Number.NaN,
    1.79 +	      Math.min(Number.NaN,0) );
    1.80 +
    1.81 +new TestCase( SECTION,
    1.82 +	      "Math.min(NaN,1)",
    1.83 +	      Number.NaN,
    1.84 +	      Math.min(Number.NaN,1) );
    1.85 +
    1.86 +new TestCase( SECTION,
    1.87 +	      "Math.min(NaN,-1)",
    1.88 +	      Number.NaN,
    1.89 +	      Math.min(Number.NaN,-1) );
    1.90 +
    1.91 +new TestCase( SECTION,
    1.92 +	      "Math.min(0,NaN)",
    1.93 +	      Number.NaN,
    1.94 +	      Math.min(0,Number.NaN) );
    1.95 +
    1.96 +new TestCase( SECTION,
    1.97 +	      "Math.min(1,NaN)",
    1.98 +	      Number.NaN,
    1.99 +	      Math.min(1,Number.NaN) );
   1.100 +
   1.101 +new TestCase( SECTION,
   1.102 +	      "Math.min(-1,NaN)",
   1.103 +	      Number.NaN,
   1.104 +	      Math.min(-1,Number.NaN) );
   1.105 +
   1.106 +new TestCase( SECTION,
   1.107 +	      "Math.min(NaN,NaN)",
   1.108 +	      Number.NaN,
   1.109 +	      Math.min(Number.NaN,Number.NaN) );
   1.110 +
   1.111 +new TestCase( SECTION,
   1.112 +	      "Math.min(1,1.0000000001)",
   1.113 +	      1,
   1.114 +	      Math.min(1,1.0000000001) );
   1.115 +
   1.116 +new TestCase( SECTION,
   1.117 +	      "Math.min(1.0000000001,1)",
   1.118 +	      1,
   1.119 +	      Math.min(1.0000000001,1) );
   1.120 +
   1.121 +new TestCase( SECTION,
   1.122 +	      "Math.min(0,0)",
   1.123 +	      0,
   1.124 +	      Math.min(0,0) );
   1.125 +
   1.126 +new TestCase( SECTION,
   1.127 +	      "Math.min(0,-0)",
   1.128 +	      -0,
   1.129 +	      Math.min(0,-0) );
   1.130 +
   1.131 +new TestCase( SECTION,
   1.132 +	      "Math.min(-0,-0)",
   1.133 +	      -0,
   1.134 +	      Math.min(-0,-0) );
   1.135 +
   1.136 +new TestCase( SECTION,
   1.137 +	      "Infinity/Math.min(0,-0)",
   1.138 +	      -Infinity,
   1.139 +	      Infinity/Math.min(0,-0) );
   1.140 +
   1.141 +new TestCase( SECTION,
   1.142 +	      "Infinity/Math.min(-0,-0)",
   1.143 +	      -Infinity,
   1.144 +	      Infinity/Math.min(-0,-0) );
   1.145 +
   1.146 +test();

mercurial