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

mercurial