js/src/tests/ecma/Math/15.8.2.8.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.8.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,100 @@
     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.8.js
    1.12 +   ECMA Section:       15.8.2.8  Math.exp(x)
    1.13 +   Description:        return an approximation to the exponential function of
    1.14 +   the argument (e raised to the power of the argument)
    1.15 +   special cases:
    1.16 +   -   if x is NaN         return NaN
    1.17 +   -   if x is 0           return 1
    1.18 +   -   if x is -0          return 1
    1.19 +   -   if x is Infinity    return Infinity
    1.20 +   -   if x is -Infinity   return 0
    1.21 +   Author:             christine@netscape.com
    1.22 +   Date:               7 july 1997
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +var SECTION = "15.8.2.8";
    1.27 +var VERSION = "ECMA_1";
    1.28 +startTest();
    1.29 +var TITLE   = "Math.exp(x)";
    1.30 +
    1.31 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.32 +
    1.33 +new TestCase( SECTION,
    1.34 +	      "Math.exp.length",
    1.35 +	      1,
    1.36 +	      Math.exp.length );
    1.37 +
    1.38 +new TestCase( SECTION,
    1.39 +	      "Math.exp()",
    1.40 +	      Number.NaN,
    1.41 +	      Math.exp() );
    1.42 +
    1.43 +new TestCase( SECTION,
    1.44 +	      "Math.exp(null)",
    1.45 +	      1,
    1.46 +	      Math.exp(null) );
    1.47 +
    1.48 +new TestCase( SECTION,
    1.49 +	      "Math.exp(void 0)",
    1.50 +	      Number.NaN,
    1.51 +	      Math.exp(void 0) );
    1.52 +
    1.53 +new TestCase( SECTION,
    1.54 +	      "Math.exp(1)",
    1.55 +	      Math.E,
    1.56 +	      Math.exp(1) );
    1.57 +
    1.58 +new TestCase( SECTION,
    1.59 +	      "Math.exp(true)",
    1.60 +	      Math.E,
    1.61 +	      Math.exp(true) );
    1.62 +
    1.63 +new TestCase( SECTION,
    1.64 +	      "Math.exp(false)",
    1.65 +	      1,
    1.66 +	      Math.exp(false) );
    1.67 +
    1.68 +new TestCase( SECTION,
    1.69 +	      "Math.exp('1')",
    1.70 +	      Math.E,
    1.71 +	      Math.exp('1') );
    1.72 +
    1.73 +new TestCase( SECTION,
    1.74 +	      "Math.exp('0')",
    1.75 +	      1,
    1.76 +	      Math.exp('0') );
    1.77 +
    1.78 +new TestCase( SECTION,
    1.79 +	      "Math.exp(NaN)",
    1.80 +	      Number.NaN,
    1.81 +	      Math.exp(Number.NaN) );
    1.82 +
    1.83 +new TestCase( SECTION,
    1.84 +	      "Math.exp(0)",
    1.85 +	      1,
    1.86 +	      Math.exp(0)          );
    1.87 +
    1.88 +new TestCase( SECTION,
    1.89 +	      "Math.exp(-0)",
    1.90 +	      1,
    1.91 +	      Math.exp(-0)         );
    1.92 +
    1.93 +new TestCase( SECTION,
    1.94 +	      "Math.exp(Infinity)",
    1.95 +	      Number.POSITIVE_INFINITY,
    1.96 +	      Math.exp(Number.POSITIVE_INFINITY) );
    1.97 +
    1.98 +new TestCase( SECTION,
    1.99 +	      "Math.exp(-Infinity)", 
   1.100 +	      0,
   1.101 +	      Math.exp(Number.NEGATIVE_INFINITY) );
   1.102 +
   1.103 +test();

mercurial