js/src/tests/ecma/Math/15.8.2.10.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.10.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,119 @@
     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.10.js
    1.12 +   ECMA Section:       15.8.2.10  Math.log(x)
    1.13 +   Description:        return an approximiation to the natural logarithm of
    1.14 +   the argument.
    1.15 +   special cases:
    1.16 +   -   if arg is NaN       result is NaN
    1.17 +   -   if arg is <0        result is NaN
    1.18 +   -   if arg is 0 or -0   result is -Infinity
    1.19 +   -   if arg is 1         result is 0
    1.20 +   -   if arg is Infinity  result is Infinity
    1.21 +   Author:             christine@netscape.com
    1.22 +   Date:               7 july 1997
    1.23 +*/
    1.24 +
    1.25 +var SECTION = "15.8.2.10";
    1.26 +var VERSION = "ECMA_1";
    1.27 +var TITLE   = "Math.log(x)";
    1.28 +var BUGNUMBER = "77391";
    1.29 +
    1.30 +startTest();
    1.31 +
    1.32 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.33 +
    1.34 +
    1.35 +new TestCase( SECTION,
    1.36 +	      "Math.log.length",
    1.37 +	      1,
    1.38 +	      Math.log.length );
    1.39 +
    1.40 +
    1.41 +new TestCase( SECTION,
    1.42 +	      "Math.log()",
    1.43 +	      Number.NaN,
    1.44 +	      Math.log() );
    1.45 +
    1.46 +new TestCase( SECTION,
    1.47 +	      "Math.log(void 0)",
    1.48 +	      Number.NaN,
    1.49 +	      Math.log(void 0) );
    1.50 +
    1.51 +new TestCase( SECTION,
    1.52 +	      "Math.log(null)",
    1.53 +	      Number.NEGATIVE_INFINITY,
    1.54 +	      Math.log(null) );
    1.55 +
    1.56 +new TestCase( SECTION,
    1.57 +	      "Math.log(true)",
    1.58 +	      0,
    1.59 +	      Math.log(true) );
    1.60 +
    1.61 +new TestCase( SECTION,
    1.62 +	      "Math.log(false)",
    1.63 +	      -Infinity,
    1.64 +	      Math.log(false) );
    1.65 +
    1.66 +new TestCase( SECTION,
    1.67 +	      "Math.log('0')",
    1.68 +	      -Infinity,
    1.69 +	      Math.log('0') );
    1.70 +
    1.71 +new TestCase( SECTION,
    1.72 +	      "Math.log('1')",
    1.73 +	      0,
    1.74 +	      Math.log('1') );
    1.75 +
    1.76 +new TestCase( SECTION,
    1.77 +	      "Math.log('Infinity')",
    1.78 +	      Infinity,
    1.79 +	      Math.log("Infinity") );
    1.80 +
    1.81 +
    1.82 +new TestCase( SECTION,
    1.83 +	      "Math.log(NaN)",
    1.84 +	      Number.NaN,
    1.85 +	      Math.log(Number.NaN) );
    1.86 +
    1.87 +new TestCase( SECTION,
    1.88 +	      "Math.log(-0.0000001)",
    1.89 +	      Number.NaN,
    1.90 +	      Math.log(-0.000001)  );
    1.91 +
    1.92 +new TestCase( SECTION,
    1.93 +	      "Math.log(-1)",
    1.94 +	      Number.NaN,
    1.95 +	      Math.log(-1)  );
    1.96 +
    1.97 +new TestCase( SECTION,
    1.98 +	      "Math.log(0)",
    1.99 +	      Number.NEGATIVE_INFINITY,
   1.100 +	      Math.log(0) );
   1.101 +
   1.102 +new TestCase( SECTION,
   1.103 +	      "Math.log(-0)",
   1.104 +	      Number.NEGATIVE_INFINITY,
   1.105 +	      Math.log(-0));
   1.106 +
   1.107 +new TestCase( SECTION,
   1.108 +	      "Math.log(1)",
   1.109 +	      0,
   1.110 +	      Math.log(1) );
   1.111 +
   1.112 +new TestCase( SECTION,
   1.113 +	      "Math.log(Infinity)",
   1.114 +	      Number.POSITIVE_INFINITY,
   1.115 +	      Math.log(Number.POSITIVE_INFINITY) );
   1.116 +
   1.117 +new TestCase( SECTION,
   1.118 +	      "Math.log(-Infinity)",
   1.119 +	      Number.NaN,
   1.120 +	      Math.log(Number.NEGATIVE_INFINITY) );
   1.121 +
   1.122 +test();

mercurial