js/src/tests/ecma/Math/15.8.2.11.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.

     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.11.js
     9    ECMA Section:       15.8.2.11 Math.max(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 */
    23 var SECTION = "15.8.2.11";
    24 var VERSION = "ECMA_1";
    25 var TITLE   = "Math.max(x, y)";
    26 var BUGNUMBER="76439";
    28 startTest();
    30 writeHeaderToLog( SECTION + " "+ TITLE);
    32 new TestCase( SECTION,
    33 	      "Math.max.length",
    34 	      2,
    35 	      Math.max.length );
    37 new TestCase( SECTION,
    38 	      "Math.max()",
    39 	      -Infinity,
    40 	      Math.max() );
    42 new TestCase( SECTION,
    43 	      "Math.max(void 0, 1)",
    44 	      Number.NaN,
    45 	      Math.max( void 0, 1 ) );
    47 new TestCase( SECTION,
    48 	      "Math.max(void 0, void 0)",
    49 	      Number.NaN,
    50 	      Math.max( void 0, void 0 ) );
    52 new TestCase( SECTION,
    53 	      "Math.max(null, 1)",
    54 	      1,
    55 	      Math.max( null, 1 ) );
    57 new TestCase( SECTION,
    58 	      "Math.max(-1, null)",
    59 	      0,
    60 	      Math.max( -1, null ) );
    62 new TestCase( SECTION,
    63 	      "Math.max(true, false)",
    64 	      1,
    65 	      Math.max(true,false) );
    67 new TestCase( SECTION,
    68 	      "Math.max('-99','99')",
    69 	      99,
    70 	      Math.max( "-99","99") );
    72 new TestCase( SECTION,
    73 	      "Math.max(NaN, Infinity)",
    74 	      Number.NaN,
    75 	      Math.max(Number.NaN,Number.POSITIVE_INFINITY) );
    77 new TestCase( SECTION,
    78 	      "Math.max(NaN, 0)",
    79 	      Number.NaN,
    80 	      Math.max(Number.NaN, 0) );
    82 new TestCase( SECTION,
    83 	      "Math.max('a string', 0)",
    84 	      Number.NaN,
    85 	      Math.max("a string", 0) );
    87 new TestCase( SECTION,
    88 	      "Math.max(NaN, 1)",
    89 	      Number.NaN,
    90 	      Math.max(Number.NaN,1) );
    92 new TestCase( SECTION,
    93 	      "Math.max('a string',Infinity)",
    94 	      Number.NaN,
    95 	      Math.max("a string", Number.POSITIVE_INFINITY) );
    97 new TestCase( SECTION,
    98 	      "Math.max(Infinity, NaN)",
    99 	      Number.NaN,
   100 	      Math.max( Number.POSITIVE_INFINITY, Number.NaN) );
   102 new TestCase( SECTION,
   103 	      "Math.max(NaN, NaN)",
   104 	      Number.NaN,
   105 	      Math.max(Number.NaN, Number.NaN) );
   107 new TestCase( SECTION,
   108 	      "Math.max(0,NaN)",
   109 	      Number.NaN,
   110 	      Math.max(0,Number.NaN) );
   112 new TestCase( SECTION,
   113 	      "Math.max(1, NaN)",
   114 	      Number.NaN,
   115 	      Math.max(1, Number.NaN) );
   117 new TestCase( SECTION,
   118 	      "Math.max(0,0)",
   119               0,
   120 	      Math.max(0,0) );
   122 new TestCase( SECTION,
   123 	      "Math.max(0,-0)",
   124 	      0,
   125 	      Math.max(0,-0) );
   127 new TestCase( SECTION,
   128 	      "Math.max(-0,0)",
   129 	      0,
   130 	      Math.max(-0,0) );
   132 new TestCase( SECTION,
   133 	      "Math.max(-0,-0)",
   134 	      -0,
   135 	      Math.max(-0,-0) );
   137 new TestCase( SECTION,
   138 	      "Infinity/Math.max(-0,-0)",
   139 	      -Infinity,
   140 	      Infinity/Math.max(-0,-0) );
   142 new TestCase( SECTION,
   143 	      "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY,
   144 	      Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) );
   146 new TestCase( SECTION,
   147 	      "Math.max(Infinity, Infinity)",
   148 	      Number.POSITIVE_INFINITY,
   149 	      Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) );
   151 new TestCase( SECTION,
   152 	      "Math.max(-Infinity,-Infinity)",
   153 	      Number.NEGATIVE_INFINITY,
   154 	      Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) );
   156 new TestCase( SECTION,
   157 	      "Math.max(1,.99999999999999)",
   158 	      1,
   159 	      Math.max(1,.99999999999999) );
   161 new TestCase( SECTION,
   162 	      "Math.max(-1,-.99999999999999)",
   163 	      -.99999999999999,
   164 	      Math.max(-1,-.99999999999999) );
   166 test();

mercurial