js/src/tests/ecma/Math/15.8.2.5.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.5.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,210 @@
     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.5.js
    1.12 +   ECMA Section:       15.8.2.5 atan2( y, x )
    1.13 +   Description:
    1.14 +
    1.15 +   Author:             christine@netscape.com
    1.16 +   Date:               7 july 1997
    1.17 +
    1.18 +*/
    1.19 +var SECTION = "15.8.2.5";
    1.20 +var VERSION = "ECMA_1";
    1.21 +var TITLE   = "Math.atan2(x,y)";
    1.22 +var BUGNUMBER="76111";
    1.23 +
    1.24 +startTest();
    1.25 +
    1.26 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.27 +
    1.28 +new TestCase( SECTION,
    1.29 +	      "Math.atan2.length",
    1.30 +	      2,
    1.31 +	      Math.atan2.length );
    1.32 +
    1.33 +new TestCase( SECTION,
    1.34 +	      "Math.atan2(NaN, 0)",
    1.35 +	      Number.NaN,
    1.36 +	      Math.atan2(Number.NaN,0) );
    1.37 +
    1.38 +new TestCase( SECTION,
    1.39 +	      "Math.atan2(null, null)",
    1.40 +	      0,
    1.41 +	      Math.atan2(null, null) );
    1.42 +
    1.43 +new TestCase( SECTION,
    1.44 +	      "Math.atan2(void 0, void 0)",
    1.45 +	      Number.NaN,
    1.46 +	      Math.atan2(void 0, void 0) );
    1.47 +
    1.48 +new TestCase( SECTION,
    1.49 +	      "Math.atan2()",
    1.50 +	      Number.NaN,
    1.51 +	      Math.atan2() );
    1.52 +
    1.53 +new TestCase( SECTION,
    1.54 +	      "Math.atan2(0, NaN)",
    1.55 +	      Number.NaN,
    1.56 +	      Math.atan2(0,Number.NaN) );
    1.57 +
    1.58 +new TestCase( SECTION,
    1.59 +	      "Math.atan2(1, 0)",
    1.60 +	      Math.PI/2,
    1.61 +	      Math.atan2(1,0)          );
    1.62 +
    1.63 +new TestCase( SECTION,
    1.64 +	      "Math.atan2(1,-0)",
    1.65 +	      Math.PI/2,
    1.66 +	      Math.atan2(1,-0)         );
    1.67 +
    1.68 +new TestCase( SECTION,
    1.69 +	      "Math.atan2(0,0.001)",
    1.70 +	      0,
    1.71 +	      Math.atan2(0,0.001)      );
    1.72 +
    1.73 +new TestCase( SECTION,
    1.74 +	      "Math.atan2(0,0)",
    1.75 +	      0,
    1.76 +	      Math.atan2(0,0)          );
    1.77 +
    1.78 +new TestCase( SECTION,
    1.79 +	      "Math.atan2(0, -0)",
    1.80 +	      Math.PI,
    1.81 +	      Math.atan2(0,-0)         );
    1.82 +
    1.83 +new TestCase( SECTION,
    1.84 +	      "Math.atan2(0, -1)",
    1.85 +	      Math.PI,
    1.86 +	      Math.atan2(0, -1)        );
    1.87 +
    1.88 +new TestCase( SECTION,
    1.89 +	      "Math.atan2(-0, 1)",
    1.90 +	      -0,
    1.91 +	      Math.atan2(-0, 1)        );
    1.92 +
    1.93 +new TestCase( SECTION,
    1.94 +	      "Infinity/Math.atan2(-0, 1)",
    1.95 +	      -Infinity,
    1.96 +	      Infinity/Math.atan2(-0,1) );
    1.97 +
    1.98 +new TestCase( SECTION,
    1.99 +	      "Math.atan2(-0,	0)",
   1.100 +	      -0,
   1.101 +	      Math.atan2(-0,0)         );
   1.102 +
   1.103 +new TestCase( SECTION,
   1.104 +	      "Math.atan2(-0,	-0)",
   1.105 +	      -Math.PI,
   1.106 +	      Math.atan2(-0, -0)       );
   1.107 +
   1.108 +new TestCase( SECTION,
   1.109 +	      "Math.atan2(-0,	-1)",
   1.110 +	      -Math.PI,
   1.111 +	      Math.atan2(-0, -1)       );
   1.112 +
   1.113 +new TestCase( SECTION,
   1.114 +	      "Math.atan2(-1,	0)",
   1.115 +	      -Math.PI/2,
   1.116 +	      Math.atan2(-1, 0)        );
   1.117 +
   1.118 +new TestCase( SECTION,
   1.119 +	      "Math.atan2(-1,	-0)",
   1.120 +	      -Math.PI/2,
   1.121 +	      Math.atan2(-1, -0)       );
   1.122 +
   1.123 +new TestCase( SECTION,
   1.124 +	      "Math.atan2(1, Infinity)",
   1.125 +	      0,
   1.126 +	      Math.atan2(1, Number.POSITIVE_INFINITY) );
   1.127 +
   1.128 +new TestCase( SECTION,
   1.129 +	      "Math.atan2(1,-Infinity)", 
   1.130 +	      Math.PI,
   1.131 +	      Math.atan2(1, Number.NEGATIVE_INFINITY) );
   1.132 +
   1.133 +new TestCase( SECTION,
   1.134 +	      "Math.atan2(-1, Infinity)",
   1.135 +	      -0,
   1.136 +	      Math.atan2(-1,Number.POSITIVE_INFINITY) );
   1.137 +
   1.138 +new TestCase( SECTION,
   1.139 +	      "Infinity/Math.atan2(-1, Infinity)",
   1.140 +	      -Infinity, 
   1.141 +	      Infinity/Math.atan2(-1,Infinity) );
   1.142 +
   1.143 +new TestCase( SECTION,
   1.144 +	      "Math.atan2(-1,-Infinity)",
   1.145 +	      -Math.PI,
   1.146 +	      Math.atan2(-1,Number.NEGATIVE_INFINITY) );
   1.147 +
   1.148 +new TestCase( SECTION,
   1.149 +	      "Math.atan2(Infinity, 0)", 
   1.150 +	      Math.PI/2,
   1.151 +	      Math.atan2(Number.POSITIVE_INFINITY, 0) );
   1.152 +
   1.153 +new TestCase( SECTION,
   1.154 +	      "Math.atan2(Infinity, 1)", 
   1.155 +	      Math.PI/2,
   1.156 +	      Math.atan2(Number.POSITIVE_INFINITY, 1) );
   1.157 +
   1.158 +new TestCase( SECTION,
   1.159 +	      "Math.atan2(Infinity,-1)", 
   1.160 +	      Math.PI/2,
   1.161 +	      Math.atan2(Number.POSITIVE_INFINITY,-1) );
   1.162 +
   1.163 +new TestCase( SECTION,
   1.164 +	      "Math.atan2(Infinity,-0)", 
   1.165 +	      Math.PI/2,
   1.166 +	      Math.atan2(Number.POSITIVE_INFINITY,-0) );
   1.167 +
   1.168 +new TestCase( SECTION,
   1.169 +	      "Math.atan2(-Infinity, 0)",
   1.170 +	      -Math.PI/2,
   1.171 +	      Math.atan2(Number.NEGATIVE_INFINITY, 0) );
   1.172 +
   1.173 +new TestCase( SECTION,
   1.174 +	      "Math.atan2(-Infinity,-0)",
   1.175 +	      -Math.PI/2,
   1.176 +	      Math.atan2(Number.NEGATIVE_INFINITY,-0) );
   1.177 +
   1.178 +new TestCase( SECTION,
   1.179 +	      "Math.atan2(-Infinity, 1)",
   1.180 +	      -Math.PI/2,
   1.181 +	      Math.atan2(Number.NEGATIVE_INFINITY, 1) );
   1.182 +
   1.183 +new TestCase( SECTION,
   1.184 +	      "Math.atan2(-Infinity, -1)",
   1.185 +	      -Math.PI/2,
   1.186 +	      Math.atan2(Number.NEGATIVE_INFINITY,-1) );
   1.187 +
   1.188 +new TestCase( SECTION,
   1.189 +	      "Math.atan2(Infinity, Infinity)",
   1.190 +	      Math.PI/4,
   1.191 +	      Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
   1.192 +
   1.193 +new TestCase( SECTION,
   1.194 +	      "Math.atan2(Infinity, -Infinity)", 
   1.195 +	      3*Math.PI/4,
   1.196 +	      Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
   1.197 +
   1.198 +new TestCase( SECTION,
   1.199 +	      "Math.atan2(-Infinity, Infinity)", 
   1.200 +	      -Math.PI/4,
   1.201 +	      Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
   1.202 +
   1.203 +new TestCase( SECTION,
   1.204 +	      "Math.atan2(-Infinity, -Infinity)",
   1.205 +	      -3*Math.PI/4,
   1.206 +	      Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
   1.207 +
   1.208 +new TestCase( SECTION,
   1.209 +	      "Math.atan2(-1, 1)",
   1.210 +	      -Math.PI/4,
   1.211 +	      Math.atan2( -1, 1) );
   1.212 +
   1.213 +test();

mercurial