js/src/tests/ecma/Math/15.8.2.5.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.5.js
     9    ECMA Section:       15.8.2.5 atan2( y, x )
    10    Description:
    12    Author:             christine@netscape.com
    13    Date:               7 july 1997
    15 */
    16 var SECTION = "15.8.2.5";
    17 var VERSION = "ECMA_1";
    18 var TITLE   = "Math.atan2(x,y)";
    19 var BUGNUMBER="76111";
    21 startTest();
    23 writeHeaderToLog( SECTION + " "+ TITLE);
    25 new TestCase( SECTION,
    26 	      "Math.atan2.length",
    27 	      2,
    28 	      Math.atan2.length );
    30 new TestCase( SECTION,
    31 	      "Math.atan2(NaN, 0)",
    32 	      Number.NaN,
    33 	      Math.atan2(Number.NaN,0) );
    35 new TestCase( SECTION,
    36 	      "Math.atan2(null, null)",
    37 	      0,
    38 	      Math.atan2(null, null) );
    40 new TestCase( SECTION,
    41 	      "Math.atan2(void 0, void 0)",
    42 	      Number.NaN,
    43 	      Math.atan2(void 0, void 0) );
    45 new TestCase( SECTION,
    46 	      "Math.atan2()",
    47 	      Number.NaN,
    48 	      Math.atan2() );
    50 new TestCase( SECTION,
    51 	      "Math.atan2(0, NaN)",
    52 	      Number.NaN,
    53 	      Math.atan2(0,Number.NaN) );
    55 new TestCase( SECTION,
    56 	      "Math.atan2(1, 0)",
    57 	      Math.PI/2,
    58 	      Math.atan2(1,0)          );
    60 new TestCase( SECTION,
    61 	      "Math.atan2(1,-0)",
    62 	      Math.PI/2,
    63 	      Math.atan2(1,-0)         );
    65 new TestCase( SECTION,
    66 	      "Math.atan2(0,0.001)",
    67 	      0,
    68 	      Math.atan2(0,0.001)      );
    70 new TestCase( SECTION,
    71 	      "Math.atan2(0,0)",
    72 	      0,
    73 	      Math.atan2(0,0)          );
    75 new TestCase( SECTION,
    76 	      "Math.atan2(0, -0)",
    77 	      Math.PI,
    78 	      Math.atan2(0,-0)         );
    80 new TestCase( SECTION,
    81 	      "Math.atan2(0, -1)",
    82 	      Math.PI,
    83 	      Math.atan2(0, -1)        );
    85 new TestCase( SECTION,
    86 	      "Math.atan2(-0, 1)",
    87 	      -0,
    88 	      Math.atan2(-0, 1)        );
    90 new TestCase( SECTION,
    91 	      "Infinity/Math.atan2(-0, 1)",
    92 	      -Infinity,
    93 	      Infinity/Math.atan2(-0,1) );
    95 new TestCase( SECTION,
    96 	      "Math.atan2(-0,	0)",
    97 	      -0,
    98 	      Math.atan2(-0,0)         );
   100 new TestCase( SECTION,
   101 	      "Math.atan2(-0,	-0)",
   102 	      -Math.PI,
   103 	      Math.atan2(-0, -0)       );
   105 new TestCase( SECTION,
   106 	      "Math.atan2(-0,	-1)",
   107 	      -Math.PI,
   108 	      Math.atan2(-0, -1)       );
   110 new TestCase( SECTION,
   111 	      "Math.atan2(-1,	0)",
   112 	      -Math.PI/2,
   113 	      Math.atan2(-1, 0)        );
   115 new TestCase( SECTION,
   116 	      "Math.atan2(-1,	-0)",
   117 	      -Math.PI/2,
   118 	      Math.atan2(-1, -0)       );
   120 new TestCase( SECTION,
   121 	      "Math.atan2(1, Infinity)",
   122 	      0,
   123 	      Math.atan2(1, Number.POSITIVE_INFINITY) );
   125 new TestCase( SECTION,
   126 	      "Math.atan2(1,-Infinity)", 
   127 	      Math.PI,
   128 	      Math.atan2(1, Number.NEGATIVE_INFINITY) );
   130 new TestCase( SECTION,
   131 	      "Math.atan2(-1, Infinity)",
   132 	      -0,
   133 	      Math.atan2(-1,Number.POSITIVE_INFINITY) );
   135 new TestCase( SECTION,
   136 	      "Infinity/Math.atan2(-1, Infinity)",
   137 	      -Infinity, 
   138 	      Infinity/Math.atan2(-1,Infinity) );
   140 new TestCase( SECTION,
   141 	      "Math.atan2(-1,-Infinity)",
   142 	      -Math.PI,
   143 	      Math.atan2(-1,Number.NEGATIVE_INFINITY) );
   145 new TestCase( SECTION,
   146 	      "Math.atan2(Infinity, 0)", 
   147 	      Math.PI/2,
   148 	      Math.atan2(Number.POSITIVE_INFINITY, 0) );
   150 new TestCase( SECTION,
   151 	      "Math.atan2(Infinity, 1)", 
   152 	      Math.PI/2,
   153 	      Math.atan2(Number.POSITIVE_INFINITY, 1) );
   155 new TestCase( SECTION,
   156 	      "Math.atan2(Infinity,-1)", 
   157 	      Math.PI/2,
   158 	      Math.atan2(Number.POSITIVE_INFINITY,-1) );
   160 new TestCase( SECTION,
   161 	      "Math.atan2(Infinity,-0)", 
   162 	      Math.PI/2,
   163 	      Math.atan2(Number.POSITIVE_INFINITY,-0) );
   165 new TestCase( SECTION,
   166 	      "Math.atan2(-Infinity, 0)",
   167 	      -Math.PI/2,
   168 	      Math.atan2(Number.NEGATIVE_INFINITY, 0) );
   170 new TestCase( SECTION,
   171 	      "Math.atan2(-Infinity,-0)",
   172 	      -Math.PI/2,
   173 	      Math.atan2(Number.NEGATIVE_INFINITY,-0) );
   175 new TestCase( SECTION,
   176 	      "Math.atan2(-Infinity, 1)",
   177 	      -Math.PI/2,
   178 	      Math.atan2(Number.NEGATIVE_INFINITY, 1) );
   180 new TestCase( SECTION,
   181 	      "Math.atan2(-Infinity, -1)",
   182 	      -Math.PI/2,
   183 	      Math.atan2(Number.NEGATIVE_INFINITY,-1) );
   185 new TestCase( SECTION,
   186 	      "Math.atan2(Infinity, Infinity)",
   187 	      Math.PI/4,
   188 	      Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
   190 new TestCase( SECTION,
   191 	      "Math.atan2(Infinity, -Infinity)", 
   192 	      3*Math.PI/4,
   193 	      Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
   195 new TestCase( SECTION,
   196 	      "Math.atan2(-Infinity, Infinity)", 
   197 	      -Math.PI/4,
   198 	      Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
   200 new TestCase( SECTION,
   201 	      "Math.atan2(-Infinity, -Infinity)",
   202 	      -3*Math.PI/4,
   203 	      Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
   205 new TestCase( SECTION,
   206 	      "Math.atan2(-1, 1)",
   207 	      -Math.PI/4,
   208 	      Math.atan2( -1, 1) );
   210 test();

mercurial