js/src/tests/ecma/Math/15.8.2.3.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.3.js
     9    ECMA Section:       15.8.2.3 asin( x )
    10    Description:        return an approximation to the arc sine 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 > 1,     the result is NaN
    15    - if x < -1,    the result is NaN
    16    - if x == +0,   the result is +0
    17    - if x == -0,   the result is -0
    18    Author:             christine@netscape.com
    19    Date:               7 july 1997
    21 */
    22 var SECTION = "15.8.2.3";
    23 var VERSION = "ECMA_1";
    24 startTest();
    25 var TITLE   = "Math.asin()";
    27 writeHeaderToLog( SECTION + " "+ TITLE);
    29 new TestCase( SECTION,
    30 	      "Math.asin()",
    31 	      Number.NaN,
    32 	      Math.asin() );
    34 new TestCase( SECTION,
    35 	      "Math.asin(void 0)",
    36 	      Number.NaN,
    37 	      Math.asin(void 0) );
    39 new TestCase( SECTION,
    40 	      "Math.asin(null)",
    41 	      0,
    42 	      Math.asin(null) );
    44 new TestCase( SECTION,
    45 	      "Math.asin(NaN)",
    46 	      Number.NaN,
    47 	      Math.asin(Number.NaN)   );
    49 new TestCase( SECTION,
    50 	      "Math.asin('string')",
    51 	      Number.NaN,
    52 	      Math.asin("string")     );
    54 new TestCase( SECTION,
    55 	      "Math.asin('0')",
    56 	      0,
    57 	      Math.asin("0") );
    59 new TestCase( SECTION,
    60 	      "Math.asin('1')",
    61 	      Math.PI/2,
    62 	      Math.asin("1") );
    64 new TestCase( SECTION,
    65 	      "Math.asin('-1')",
    66 	      -Math.PI/2,
    67 	      Math.asin("-1") );
    69 new TestCase( SECTION,
    70 	      "Math.asin(Math.SQRT1_2+'')",
    71 	      Math.PI/4,
    72 	      Math.asin(Math.SQRT1_2+'') );
    74 new TestCase( SECTION,
    75 	      "Math.asin(-Math.SQRT1_2+'')",
    76 	      -Math.PI/4,
    77 	      Math.asin(-Math.SQRT1_2+'') );
    79 new TestCase( SECTION,
    80 	      "Math.asin(1.000001)",
    81 	      Number.NaN,
    82 	      Math.asin(1.000001)     );
    84 new TestCase( SECTION,
    85 	      "Math.asin(-1.000001)",
    86 	      Number.NaN,
    87 	      Math.asin(-1.000001)    );
    89 new TestCase( SECTION,
    90 	      "Math.asin(0)",
    91 	      0,
    92 	      Math.asin(0)            );
    94 new TestCase( SECTION,
    95 	      "Math.asin(-0)",
    96 	      -0,
    97 	      Math.asin(-0)           );
    99 new TestCase( SECTION,
   100 	      "Infinity/Math.asin(-0)",
   101 	      -Infinity,
   102 	      Infinity/Math.asin(-0) );
   104 new TestCase( SECTION,
   105 	      "Math.asin(1)",
   106 	      Math.PI/2,
   107 	      Math.asin(1)            );
   109 new TestCase( SECTION,
   110 	      "Math.asin(-1)",
   111 	      -Math.PI/2,
   112 	      Math.asin(-1)            );
   114 new TestCase( SECTION,
   115 	      "Math.asin(Math.SQRT1_2))",
   116 	      Math.PI/4,
   117 	      Math.asin(Math.SQRT1_2) );
   119 new TestCase( SECTION,
   120 	      "Math.asin(-Math.SQRT1_2))",
   121 	      -Math.PI/4,
   122 	      Math.asin(-Math.SQRT1_2));
   124 test();

mercurial