js/src/tests/ecma/Math/15.8.2.4.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.4.js
     9    ECMA Section:       15.8.2.4 atan( x )
    10    Description:        return an approximation to the arc tangent of the
    11    argument.  the result is expressed in radians and
    12    range is from -PI/2 to +PI/2.  special cases:
    13    - if x is NaN,  the result is NaN
    14    - if x == +0,   the result is +0
    15    - if x == -0,   the result is -0
    16    - if x == +Infinity,    the result is approximately +PI/2
    17    - if x == -Infinity,    the result is approximately -PI/2
    18    Author:             christine@netscape.com
    19    Date:               7 july 1997
    21 */
    23 var SECTION = "15.8.2.4";
    24 var VERSION = "ECMA_1";
    25 var TITLE   = "Math.atan()";
    26 var BUGNUMBER="77391";
    28 startTest();
    30 writeHeaderToLog( SECTION + " "+ TITLE);
    32 new TestCase( SECTION,
    33 	      "Math.atan.length",
    34 	      1,
    35 	      Math.atan.length );
    37 new TestCase( SECTION,
    38 	      "Math.atan()",
    39 	      Number.NaN,
    40 	      Math.atan() );
    42 new TestCase( SECTION,
    43 	      "Math.atan(void 0)",
    44 	      Number.NaN,
    45 	      Math.atan(void 0) );
    47 new TestCase( SECTION,
    48 	      "Math.atan(null)",
    49 	      0,
    50 	      Math.atan(null) );
    52 new TestCase( SECTION,
    53 	      "Math.atan(NaN)",
    54 	      Number.NaN,
    55 	      Math.atan(Number.NaN) );
    57 new TestCase( SECTION,
    58 	      "Math.atan('a string')",
    59 	      Number.NaN,
    60 	      Math.atan("a string") );
    62 new TestCase( SECTION,
    63 	      "Math.atan('0')",
    64 	      0,
    65 	      Math.atan('0') );
    67 new TestCase( SECTION,
    68 	      "Math.atan('1')",
    69 	      Math.PI/4,
    70 	      Math.atan('1') );
    72 new TestCase( SECTION,
    73 	      "Math.atan('-1')",
    74 	      -Math.PI/4,
    75 	      Math.atan('-1') );
    77 new TestCase( SECTION,
    78 	      "Math.atan('Infinity)",
    79 	      Math.PI/2,
    80 	      Math.atan('Infinity') );
    82 new TestCase( SECTION,
    83 	      "Math.atan('-Infinity)",
    84 	      -Math.PI/2,
    85 	      Math.atan('-Infinity') );
    87 new TestCase( SECTION,
    88 	      "Math.atan(0)",
    89 	      0,
    90 	      Math.atan(0)          );
    92 new TestCase( SECTION,
    93 	      "Math.atan(-0)",	
    94 	      -0,
    95 	      Math.atan(-0)         );
    97 new TestCase( SECTION,
    98 	      "Infinity/Math.atan(-0)",
    99 	      -Infinity,
   100 	      Infinity/Math.atan(-0) );
   102 new TestCase( SECTION,
   103 	      "Math.atan(Infinity)",
   104 	      Math.PI/2,
   105 	      Math.atan(Number.POSITIVE_INFINITY) );
   107 new TestCase( SECTION,
   108 	      "Math.atan(-Infinity)",
   109 	      -Math.PI/2,
   110 	      Math.atan(Number.NEGATIVE_INFINITY) );
   112 new TestCase( SECTION,
   113 	      "Math.atan(1)",
   114 	      Math.PI/4,
   115 	      Math.atan(1)          );
   117 new TestCase( SECTION,
   118 	      "Math.atan(-1)",
   119 	      -Math.PI/4,
   120 	      Math.atan(-1)         );
   122 test();

mercurial