Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | File Name: 15.8.2.5.js |
michael@0 | 9 | ECMA Section: 15.8.2.5 atan2( y, x ) |
michael@0 | 10 | Description: |
michael@0 | 11 | |
michael@0 | 12 | Author: christine@netscape.com |
michael@0 | 13 | Date: 7 july 1997 |
michael@0 | 14 | |
michael@0 | 15 | */ |
michael@0 | 16 | var SECTION = "15.8.2.5"; |
michael@0 | 17 | var VERSION = "ECMA_1"; |
michael@0 | 18 | var TITLE = "Math.atan2(x,y)"; |
michael@0 | 19 | var BUGNUMBER="76111"; |
michael@0 | 20 | |
michael@0 | 21 | startTest(); |
michael@0 | 22 | |
michael@0 | 23 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 24 | |
michael@0 | 25 | new TestCase( SECTION, |
michael@0 | 26 | "Math.atan2.length", |
michael@0 | 27 | 2, |
michael@0 | 28 | Math.atan2.length ); |
michael@0 | 29 | |
michael@0 | 30 | new TestCase( SECTION, |
michael@0 | 31 | "Math.atan2(NaN, 0)", |
michael@0 | 32 | Number.NaN, |
michael@0 | 33 | Math.atan2(Number.NaN,0) ); |
michael@0 | 34 | |
michael@0 | 35 | new TestCase( SECTION, |
michael@0 | 36 | "Math.atan2(null, null)", |
michael@0 | 37 | 0, |
michael@0 | 38 | Math.atan2(null, null) ); |
michael@0 | 39 | |
michael@0 | 40 | new TestCase( SECTION, |
michael@0 | 41 | "Math.atan2(void 0, void 0)", |
michael@0 | 42 | Number.NaN, |
michael@0 | 43 | Math.atan2(void 0, void 0) ); |
michael@0 | 44 | |
michael@0 | 45 | new TestCase( SECTION, |
michael@0 | 46 | "Math.atan2()", |
michael@0 | 47 | Number.NaN, |
michael@0 | 48 | Math.atan2() ); |
michael@0 | 49 | |
michael@0 | 50 | new TestCase( SECTION, |
michael@0 | 51 | "Math.atan2(0, NaN)", |
michael@0 | 52 | Number.NaN, |
michael@0 | 53 | Math.atan2(0,Number.NaN) ); |
michael@0 | 54 | |
michael@0 | 55 | new TestCase( SECTION, |
michael@0 | 56 | "Math.atan2(1, 0)", |
michael@0 | 57 | Math.PI/2, |
michael@0 | 58 | Math.atan2(1,0) ); |
michael@0 | 59 | |
michael@0 | 60 | new TestCase( SECTION, |
michael@0 | 61 | "Math.atan2(1,-0)", |
michael@0 | 62 | Math.PI/2, |
michael@0 | 63 | Math.atan2(1,-0) ); |
michael@0 | 64 | |
michael@0 | 65 | new TestCase( SECTION, |
michael@0 | 66 | "Math.atan2(0,0.001)", |
michael@0 | 67 | 0, |
michael@0 | 68 | Math.atan2(0,0.001) ); |
michael@0 | 69 | |
michael@0 | 70 | new TestCase( SECTION, |
michael@0 | 71 | "Math.atan2(0,0)", |
michael@0 | 72 | 0, |
michael@0 | 73 | Math.atan2(0,0) ); |
michael@0 | 74 | |
michael@0 | 75 | new TestCase( SECTION, |
michael@0 | 76 | "Math.atan2(0, -0)", |
michael@0 | 77 | Math.PI, |
michael@0 | 78 | Math.atan2(0,-0) ); |
michael@0 | 79 | |
michael@0 | 80 | new TestCase( SECTION, |
michael@0 | 81 | "Math.atan2(0, -1)", |
michael@0 | 82 | Math.PI, |
michael@0 | 83 | Math.atan2(0, -1) ); |
michael@0 | 84 | |
michael@0 | 85 | new TestCase( SECTION, |
michael@0 | 86 | "Math.atan2(-0, 1)", |
michael@0 | 87 | -0, |
michael@0 | 88 | Math.atan2(-0, 1) ); |
michael@0 | 89 | |
michael@0 | 90 | new TestCase( SECTION, |
michael@0 | 91 | "Infinity/Math.atan2(-0, 1)", |
michael@0 | 92 | -Infinity, |
michael@0 | 93 | Infinity/Math.atan2(-0,1) ); |
michael@0 | 94 | |
michael@0 | 95 | new TestCase( SECTION, |
michael@0 | 96 | "Math.atan2(-0, 0)", |
michael@0 | 97 | -0, |
michael@0 | 98 | Math.atan2(-0,0) ); |
michael@0 | 99 | |
michael@0 | 100 | new TestCase( SECTION, |
michael@0 | 101 | "Math.atan2(-0, -0)", |
michael@0 | 102 | -Math.PI, |
michael@0 | 103 | Math.atan2(-0, -0) ); |
michael@0 | 104 | |
michael@0 | 105 | new TestCase( SECTION, |
michael@0 | 106 | "Math.atan2(-0, -1)", |
michael@0 | 107 | -Math.PI, |
michael@0 | 108 | Math.atan2(-0, -1) ); |
michael@0 | 109 | |
michael@0 | 110 | new TestCase( SECTION, |
michael@0 | 111 | "Math.atan2(-1, 0)", |
michael@0 | 112 | -Math.PI/2, |
michael@0 | 113 | Math.atan2(-1, 0) ); |
michael@0 | 114 | |
michael@0 | 115 | new TestCase( SECTION, |
michael@0 | 116 | "Math.atan2(-1, -0)", |
michael@0 | 117 | -Math.PI/2, |
michael@0 | 118 | Math.atan2(-1, -0) ); |
michael@0 | 119 | |
michael@0 | 120 | new TestCase( SECTION, |
michael@0 | 121 | "Math.atan2(1, Infinity)", |
michael@0 | 122 | 0, |
michael@0 | 123 | Math.atan2(1, Number.POSITIVE_INFINITY) ); |
michael@0 | 124 | |
michael@0 | 125 | new TestCase( SECTION, |
michael@0 | 126 | "Math.atan2(1,-Infinity)", |
michael@0 | 127 | Math.PI, |
michael@0 | 128 | Math.atan2(1, Number.NEGATIVE_INFINITY) ); |
michael@0 | 129 | |
michael@0 | 130 | new TestCase( SECTION, |
michael@0 | 131 | "Math.atan2(-1, Infinity)", |
michael@0 | 132 | -0, |
michael@0 | 133 | Math.atan2(-1,Number.POSITIVE_INFINITY) ); |
michael@0 | 134 | |
michael@0 | 135 | new TestCase( SECTION, |
michael@0 | 136 | "Infinity/Math.atan2(-1, Infinity)", |
michael@0 | 137 | -Infinity, |
michael@0 | 138 | Infinity/Math.atan2(-1,Infinity) ); |
michael@0 | 139 | |
michael@0 | 140 | new TestCase( SECTION, |
michael@0 | 141 | "Math.atan2(-1,-Infinity)", |
michael@0 | 142 | -Math.PI, |
michael@0 | 143 | Math.atan2(-1,Number.NEGATIVE_INFINITY) ); |
michael@0 | 144 | |
michael@0 | 145 | new TestCase( SECTION, |
michael@0 | 146 | "Math.atan2(Infinity, 0)", |
michael@0 | 147 | Math.PI/2, |
michael@0 | 148 | Math.atan2(Number.POSITIVE_INFINITY, 0) ); |
michael@0 | 149 | |
michael@0 | 150 | new TestCase( SECTION, |
michael@0 | 151 | "Math.atan2(Infinity, 1)", |
michael@0 | 152 | Math.PI/2, |
michael@0 | 153 | Math.atan2(Number.POSITIVE_INFINITY, 1) ); |
michael@0 | 154 | |
michael@0 | 155 | new TestCase( SECTION, |
michael@0 | 156 | "Math.atan2(Infinity,-1)", |
michael@0 | 157 | Math.PI/2, |
michael@0 | 158 | Math.atan2(Number.POSITIVE_INFINITY,-1) ); |
michael@0 | 159 | |
michael@0 | 160 | new TestCase( SECTION, |
michael@0 | 161 | "Math.atan2(Infinity,-0)", |
michael@0 | 162 | Math.PI/2, |
michael@0 | 163 | Math.atan2(Number.POSITIVE_INFINITY,-0) ); |
michael@0 | 164 | |
michael@0 | 165 | new TestCase( SECTION, |
michael@0 | 166 | "Math.atan2(-Infinity, 0)", |
michael@0 | 167 | -Math.PI/2, |
michael@0 | 168 | Math.atan2(Number.NEGATIVE_INFINITY, 0) ); |
michael@0 | 169 | |
michael@0 | 170 | new TestCase( SECTION, |
michael@0 | 171 | "Math.atan2(-Infinity,-0)", |
michael@0 | 172 | -Math.PI/2, |
michael@0 | 173 | Math.atan2(Number.NEGATIVE_INFINITY,-0) ); |
michael@0 | 174 | |
michael@0 | 175 | new TestCase( SECTION, |
michael@0 | 176 | "Math.atan2(-Infinity, 1)", |
michael@0 | 177 | -Math.PI/2, |
michael@0 | 178 | Math.atan2(Number.NEGATIVE_INFINITY, 1) ); |
michael@0 | 179 | |
michael@0 | 180 | new TestCase( SECTION, |
michael@0 | 181 | "Math.atan2(-Infinity, -1)", |
michael@0 | 182 | -Math.PI/2, |
michael@0 | 183 | Math.atan2(Number.NEGATIVE_INFINITY,-1) ); |
michael@0 | 184 | |
michael@0 | 185 | new TestCase( SECTION, |
michael@0 | 186 | "Math.atan2(Infinity, Infinity)", |
michael@0 | 187 | Math.PI/4, |
michael@0 | 188 | Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); |
michael@0 | 189 | |
michael@0 | 190 | new TestCase( SECTION, |
michael@0 | 191 | "Math.atan2(Infinity, -Infinity)", |
michael@0 | 192 | 3*Math.PI/4, |
michael@0 | 193 | Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); |
michael@0 | 194 | |
michael@0 | 195 | new TestCase( SECTION, |
michael@0 | 196 | "Math.atan2(-Infinity, Infinity)", |
michael@0 | 197 | -Math.PI/4, |
michael@0 | 198 | Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); |
michael@0 | 199 | |
michael@0 | 200 | new TestCase( SECTION, |
michael@0 | 201 | "Math.atan2(-Infinity, -Infinity)", |
michael@0 | 202 | -3*Math.PI/4, |
michael@0 | 203 | Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); |
michael@0 | 204 | |
michael@0 | 205 | new TestCase( SECTION, |
michael@0 | 206 | "Math.atan2(-1, 1)", |
michael@0 | 207 | -Math.PI/4, |
michael@0 | 208 | Math.atan2( -1, 1) ); |
michael@0 | 209 | |
michael@0 | 210 | test(); |