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

mercurial