js/src/tests/ecma/Math/15.8.2.4.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.4.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,122 @@
     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.4.js
    1.12 +   ECMA Section:       15.8.2.4 atan( x )
    1.13 +   Description:        return an approximation to the arc tangent of the
    1.14 +   argument.  the result is expressed in radians and
    1.15 +   range is from -PI/2 to +PI/2.  special cases:
    1.16 +   - if x is NaN,  the result is NaN
    1.17 +   - if x == +0,   the result is +0
    1.18 +   - if x == -0,   the result is -0
    1.19 +   - if x == +Infinity,    the result is approximately +PI/2
    1.20 +   - if x == -Infinity,    the result is approximately -PI/2
    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.4";
    1.27 +var VERSION = "ECMA_1";
    1.28 +var TITLE   = "Math.atan()";
    1.29 +var BUGNUMBER="77391";
    1.30 +
    1.31 +startTest();
    1.32 +
    1.33 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.34 +
    1.35 +new TestCase( SECTION,
    1.36 +	      "Math.atan.length",
    1.37 +	      1,
    1.38 +	      Math.atan.length );
    1.39 +
    1.40 +new TestCase( SECTION,
    1.41 +	      "Math.atan()",
    1.42 +	      Number.NaN,
    1.43 +	      Math.atan() );
    1.44 +
    1.45 +new TestCase( SECTION,
    1.46 +	      "Math.atan(void 0)",
    1.47 +	      Number.NaN,
    1.48 +	      Math.atan(void 0) );
    1.49 +
    1.50 +new TestCase( SECTION,
    1.51 +	      "Math.atan(null)",
    1.52 +	      0,
    1.53 +	      Math.atan(null) );
    1.54 +
    1.55 +new TestCase( SECTION,
    1.56 +	      "Math.atan(NaN)",
    1.57 +	      Number.NaN,
    1.58 +	      Math.atan(Number.NaN) );
    1.59 +
    1.60 +new TestCase( SECTION,
    1.61 +	      "Math.atan('a string')",
    1.62 +	      Number.NaN,
    1.63 +	      Math.atan("a string") );
    1.64 +
    1.65 +new TestCase( SECTION,
    1.66 +	      "Math.atan('0')",
    1.67 +	      0,
    1.68 +	      Math.atan('0') );
    1.69 +
    1.70 +new TestCase( SECTION,
    1.71 +	      "Math.atan('1')",
    1.72 +	      Math.PI/4,
    1.73 +	      Math.atan('1') );
    1.74 +
    1.75 +new TestCase( SECTION,
    1.76 +	      "Math.atan('-1')",
    1.77 +	      -Math.PI/4,
    1.78 +	      Math.atan('-1') );
    1.79 +
    1.80 +new TestCase( SECTION,
    1.81 +	      "Math.atan('Infinity)",
    1.82 +	      Math.PI/2,
    1.83 +	      Math.atan('Infinity') );
    1.84 +
    1.85 +new TestCase( SECTION,
    1.86 +	      "Math.atan('-Infinity)",
    1.87 +	      -Math.PI/2,
    1.88 +	      Math.atan('-Infinity') );
    1.89 +
    1.90 +new TestCase( SECTION,
    1.91 +	      "Math.atan(0)",
    1.92 +	      0,
    1.93 +	      Math.atan(0)          );
    1.94 +
    1.95 +new TestCase( SECTION,
    1.96 +	      "Math.atan(-0)",	
    1.97 +	      -0,
    1.98 +	      Math.atan(-0)         );
    1.99 +
   1.100 +new TestCase( SECTION,
   1.101 +	      "Infinity/Math.atan(-0)",
   1.102 +	      -Infinity,
   1.103 +	      Infinity/Math.atan(-0) );
   1.104 +
   1.105 +new TestCase( SECTION,
   1.106 +	      "Math.atan(Infinity)",
   1.107 +	      Math.PI/2,
   1.108 +	      Math.atan(Number.POSITIVE_INFINITY) );
   1.109 +
   1.110 +new TestCase( SECTION,
   1.111 +	      "Math.atan(-Infinity)",
   1.112 +	      -Math.PI/2,
   1.113 +	      Math.atan(Number.NEGATIVE_INFINITY) );
   1.114 +
   1.115 +new TestCase( SECTION,
   1.116 +	      "Math.atan(1)",
   1.117 +	      Math.PI/4,
   1.118 +	      Math.atan(1)          );
   1.119 +
   1.120 +new TestCase( SECTION,
   1.121 +	      "Math.atan(-1)",
   1.122 +	      -Math.PI/4,
   1.123 +	      Math.atan(-1)         );
   1.124 +
   1.125 +test();

mercurial