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

mercurial