js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A2.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.

michael@0 1 // Copyright 2009 the Sputnik authors. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * The MV of StringNumericLiteral ::: StrWhiteSpace is 0
michael@0 6 *
michael@0 7 * @path ch09/9.3/9.3.1/S9.3.1_A2.js
michael@0 8 * @description Strings with various WhiteSpaces convert to Number by explicit transformation
michael@0 9 */
michael@0 10
michael@0 11 // CHECK#1
michael@0 12 if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== 0) {
michael@0 13 $ERROR('#1.1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === 0. Actual: ' + (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")));
michael@0 14 } else {
michael@0 15 if (1/Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number.POSITIVE_INFINITY) {
michael@0 16 $ERROR('#1.2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === +0. Actual: -0');
michael@0 17 }
michael@0 18 }
michael@0 19
michael@0 20 // CHECK#2
michael@0 21 if (Number(" ") !== 0) {
michael@0 22 $ERROR('#2.1: Number(" ") === 0. Actual: ' + (Number(" ")));
michael@0 23 } else {
michael@0 24 if (1/Number(" ") !== Number.POSITIVE_INFINITY) {
michael@0 25 $ERROR('#2.2: Number(" ") === +0. Actual: -0');
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 // CHECK#3
michael@0 30 if (Number("\t") !== 0) {
michael@0 31 $ERROR('#3.1: Number("\\t") === 0. Actual: ' + (Number("\t")));
michael@0 32 } else {
michael@0 33 if (1/Number("\t") !== Number.POSITIVE_INFINITY) {
michael@0 34 $ERROR('#3.2: Number("\\t") === +0. Actual: -0');
michael@0 35 }
michael@0 36 }
michael@0 37
michael@0 38 // CHECK#4
michael@0 39 if (Number("\r") !== 0) {
michael@0 40 $ERROR('#4.1: Number("\\r") === 0. Actual: ' + (Number("\r")));
michael@0 41 } else {
michael@0 42 if (1/Number("\r") !== Number.POSITIVE_INFINITY) {
michael@0 43 $ERROR('#4.2: Number("\\r") === +0. Actual: -0');
michael@0 44 }
michael@0 45 }
michael@0 46
michael@0 47 // CHECK#5
michael@0 48 if (Number("\n") !== 0) {
michael@0 49 $ERROR('#5.1: Number("\\n") === 0. Actual: ' + (Number("\n")));
michael@0 50 } else {
michael@0 51 if (1/Number("\n") !== Number.POSITIVE_INFINITY) {
michael@0 52 $ERROR('#5.2: Number("\\n") === +0. Actual: -0');
michael@0 53 }
michael@0 54 }
michael@0 55
michael@0 56 // CHECK#6
michael@0 57 if (Number("\f") !== 0) {
michael@0 58 $ERROR('#6.1: Number("\\f") === 0. Actual: ' + (Number("\f")));
michael@0 59 } else {
michael@0 60 if (1/Number("\f") !== Number.POSITIVE_INFINITY) {
michael@0 61 $ERROR('#6.2: Number("\\f") === +0. Actual: -0');
michael@0 62 }
michael@0 63 }
michael@0 64
michael@0 65 // CHECK#7
michael@0 66 if (Number("\u0009") !== 0) {
michael@0 67 $ERROR('#7.1: Number("\\u0009") === 0. Actual: ' + (Number("\u0009")));
michael@0 68 } else {
michael@0 69 if (1/Number("\u0009") !== Number.POSITIVE_INFINITY) {
michael@0 70 $ERROR('#7.2: Number("\\u0009") === +0. Actual: -0');
michael@0 71 }
michael@0 72 }
michael@0 73
michael@0 74 // CHECK#8
michael@0 75 if (Number("\u000A") !== 0) {
michael@0 76 $ERROR('#8.1: Number("\\u000A") === 0. Actual: ' + (Number("\u000A")));
michael@0 77 } else {
michael@0 78 if (1/Number("\u000A") !== Number.POSITIVE_INFINITY) {
michael@0 79 $ERROR('#8.2: Number("\\u000A") === +0. Actual: -0');
michael@0 80 }
michael@0 81 }
michael@0 82
michael@0 83 // CHECK#9
michael@0 84 if (Number("\u000B") !== 0) {
michael@0 85 $ERROR('#9.1: Number("\\u000B") === 0. Actual: ' + (Number("\u000B")));
michael@0 86 } else {
michael@0 87 if (1/Number("\u000B") !== Number.POSITIVE_INFINITY) {
michael@0 88 $ERROR('#9.1.2: Number("\\u000B") === +0. Actual: -0');
michael@0 89 }
michael@0 90 }
michael@0 91
michael@0 92 // CHECK#10
michael@0 93 if (Number("\u000C") !== 0) {
michael@0 94 $ERROR('#10.1: Number("\\u000C") === 0. Actual: ' + (Number("\u000C")));
michael@0 95 } else {
michael@0 96 if (1/Number("\u000C") !== Number.POSITIVE_INFINITY) {
michael@0 97 $ERROR('#10.2: Number("\\u000C") === +0. Actual: -0');
michael@0 98 }
michael@0 99 }
michael@0 100
michael@0 101 // CHECK#11
michael@0 102 if (Number("\u000D") !== 0) {
michael@0 103 $ERROR('#11.1: Number("\\u000D") === 0. Actual: ' + (Number("\u000D")));
michael@0 104 } else {
michael@0 105 if (1/Number("\u000D") !== Number.POSITIVE_INFINITY) {
michael@0 106 $ERROR('#11.2: Number("\\u000D") === +0. Actual: -0');
michael@0 107 }
michael@0 108 }
michael@0 109
michael@0 110 // CHECK#12
michael@0 111 if (Number("\u00A0") !== 0) {
michael@0 112 $ERROR('#12.1: Number("\\u00A0") === 0. Actual: ' + (Number("\u00A0")));
michael@0 113 } else {
michael@0 114 if (1/Number("\u00A0") !== Number.POSITIVE_INFINITY) {
michael@0 115 $ERROR('#12.2: Number("\\u00A0") === +0. Actual: -0');
michael@0 116 }
michael@0 117 }
michael@0 118
michael@0 119 // CHECK#13
michael@0 120 if (Number("\u0020") !== 0) {
michael@0 121 $ERROR('#13.1: Number("\\u0020") === 0. Actual: ' + (Number("\u0020")));
michael@0 122 } else {
michael@0 123 if (1/Number("\u0020") !== Number.POSITIVE_INFINITY) {
michael@0 124 $ERROR('#13.2: Number("\\u0020") === +0. Actual: -0');
michael@0 125 }
michael@0 126 }
michael@0 127
michael@0 128 // CHECK#14
michael@0 129 if (Number("\u2028") !== 0) {
michael@0 130 $ERROR('#14.1: Number("\\u2028") === 0. Actual: ' + (Number("\u2028")));
michael@0 131 } else {
michael@0 132 if (1/Number("\u2028") !== Number.POSITIVE_INFINITY) {
michael@0 133 $ERROR('#14.2: Number("\\u2028") === +0. Actual: -0');
michael@0 134 }
michael@0 135 }
michael@0 136
michael@0 137 // CHECK#15
michael@0 138 if (Number("\u2029") !== 0) {
michael@0 139 $ERROR('#15.1: Number("\\u2029") === 0. Actual: ' + (Number("\u2029")));
michael@0 140 } else {
michael@0 141 if (1/Number("\u2029") !== Number.POSITIVE_INFINITY) {
michael@0 142 $ERROR('#15.2: Number("\\u2029") === +0. Actual: -0');
michael@0 143 }
michael@0 144 }
michael@0 145
michael@0 146 // CHECK#16
michael@0 147 if (Number("\u1680") !== 0) {
michael@0 148 $ERROR('#16.1: Number("\\u1680") === 0. Actual: ' + (Number("\u1680")));
michael@0 149 } else {
michael@0 150 if (1/Number("\u1680") !== Number.POSITIVE_INFINITY) {
michael@0 151 $ERROR('#16.2: Number("\\u1680") === +0. Actual: -0');
michael@0 152 }
michael@0 153 }
michael@0 154
michael@0 155 // CHECK#17
michael@0 156 if (Number("\u180E") !== 0) {
michael@0 157 $ERROR('#17.1: Number("\\u180E") === 0. Actual: ' + (Number("\u180E")));
michael@0 158 } else {
michael@0 159 if (1/Number("\u180E") !== Number.POSITIVE_INFINITY) {
michael@0 160 $ERROR('#17.2: Number("\\u180E") === +0. Actual: -0');
michael@0 161 }
michael@0 162 }
michael@0 163
michael@0 164 // CHECK#18
michael@0 165 if (Number("\u2000") !== 0) {
michael@0 166 $ERROR('#18.1: Number("\\u2000") === 0. Actual: ' + (Number("\u2000")));
michael@0 167 } else {
michael@0 168 if (1/Number("\u2000") !== Number.POSITIVE_INFINITY) {
michael@0 169 $ERROR('#18.2: Number("\\u2000") === +0. Actual: -0');
michael@0 170 }
michael@0 171 }
michael@0 172
michael@0 173 // CHECK#19
michael@0 174 if (Number("\u2001") !== 0) {
michael@0 175 $ERROR('#19.1: Number("\\u2001") === 0. Actual: ' + (Number("\u2001")));
michael@0 176 } else {
michael@0 177 if (1/Number("\u2001") !== Number.POSITIVE_INFINITY) {
michael@0 178 $ERROR('#19.2: Number("\\u2001") === +0. Actual: -0');
michael@0 179 }
michael@0 180 }
michael@0 181
michael@0 182 // CHECK#20
michael@0 183 if (Number("\u2002") !== 0) {
michael@0 184 $ERROR('#20.1: Number("\\u2002") === 0. Actual: ' + (Number("\u2002")));
michael@0 185 } else {
michael@0 186 if (1/Number("\u2002") !== Number.POSITIVE_INFINITY) {
michael@0 187 $ERROR('#20.2: Number("\\u2002") === +0. Actual: -0');
michael@0 188 }
michael@0 189 }
michael@0 190
michael@0 191 // CHECK#21
michael@0 192 if (Number("\u2003") !== 0) {
michael@0 193 $ERROR('#21.1: Number("\\u2003") === 0. Actual: ' + (Number("\u2003")));
michael@0 194 } else {
michael@0 195 if (1/Number("\u2003") !== Number.POSITIVE_INFINITY) {
michael@0 196 $ERROR('#21.2: Number("\\u2003") === +0. Actual: -0');
michael@0 197 }
michael@0 198 }
michael@0 199
michael@0 200 // CHECK#22
michael@0 201 if (Number("\u2004") !== 0) {
michael@0 202 $ERROR('#22.1: Number("\\u2004") === 0. Actual: ' + (Number("\u2004")));
michael@0 203 } else {
michael@0 204 if (1/Number("\u2004") !== Number.POSITIVE_INFINITY) {
michael@0 205 $ERROR('#22.2: Number("\\u2004") === +0. Actual: -0');
michael@0 206 }
michael@0 207 }
michael@0 208
michael@0 209 // CHECK#23
michael@0 210 if (Number("\u2005") !== 0) {
michael@0 211 $ERROR('#23.1: Number("\\u2005") === 0. Actual: ' + (Number("\u2005")));
michael@0 212 } else {
michael@0 213 if (1/Number("\u2005") !== Number.POSITIVE_INFINITY) {
michael@0 214 $ERROR('#23.2: Number("\\u2005") === +0. Actual: -0');
michael@0 215 }
michael@0 216 }
michael@0 217
michael@0 218 // CHECK#24
michael@0 219 if (Number("\u2006") !== 0) {
michael@0 220 $ERROR('#24.1: Number("\\u2006") === 0. Actual: ' + (Number("\u2006")));
michael@0 221 } else {
michael@0 222 if (1/Number("\u2006") !== Number.POSITIVE_INFINITY) {
michael@0 223 $ERROR('#24.2: Number("\\u2006") === +0. Actual: -0');
michael@0 224 }
michael@0 225 }
michael@0 226
michael@0 227 // CHECK#25
michael@0 228 if (Number("\u2007") !== 0) {
michael@0 229 $ERROR('#25.1: Number("\\u2007") === 0. Actual: ' + (Number("\u2007")));
michael@0 230 } else {
michael@0 231 if (1/Number("\u2007") !== Number.POSITIVE_INFINITY) {
michael@0 232 $ERROR('#25.2: Number("\\u2007") === +0. Actual: -0');
michael@0 233 }
michael@0 234 }
michael@0 235
michael@0 236 // CHECK#26
michael@0 237 if (Number("\u2008") !== 0) {
michael@0 238 $ERROR('#26.1: Number("\\u2008") === 0. Actual: ' + (Number("\u2008")));
michael@0 239 } else {
michael@0 240 if (1/Number("\u2008") !== Number.POSITIVE_INFINITY) {
michael@0 241 $ERROR('#26.2: Number("\\u2008") === +0. Actual: -0');
michael@0 242 }
michael@0 243 }
michael@0 244
michael@0 245 // CHECK#27
michael@0 246 if (Number("\u2009") !== 0) {
michael@0 247 $ERROR('#27.1: Number("\\u2009") === 0. Actual: ' + (Number("\u2009")));
michael@0 248 } else {
michael@0 249 if (1/Number("\u2009") !== Number.POSITIVE_INFINITY) {
michael@0 250 $ERROR('#27.2: Number("\\u2009") === +0. Actual: -0');
michael@0 251 }
michael@0 252 }
michael@0 253
michael@0 254 // CHECK#28
michael@0 255 if (Number("\u200A") !== 0) {
michael@0 256 $ERROR('#28.1: Number("\\u200A") === 0. Actual: ' + (Number("\u200A")));
michael@0 257 } else {
michael@0 258 if (1/Number("\u200A") !== Number.POSITIVE_INFINITY) {
michael@0 259 $ERROR('#28.2: Number("\\u200A") === +0. Actual: -0');
michael@0 260 }
michael@0 261 }
michael@0 262
michael@0 263 // CHECK#29
michael@0 264 if (Number("\u202F") !== 0) {
michael@0 265 $ERROR('#29.1: Number("\\u202F") === 0. Actual: ' + (Number("\u202F")));
michael@0 266 } else {
michael@0 267 if (1/Number("\u202F") !== Number.POSITIVE_INFINITY) {
michael@0 268 $ERROR('#29.2: Number("\\u202F") === +0. Actual: -0');
michael@0 269 }
michael@0 270 }
michael@0 271
michael@0 272 // CHECK#30
michael@0 273 if (Number("\u205F") !== 0) {
michael@0 274 $ERROR('#30.1: Number("\\u205F") === 0. Actual: ' + (Number("\u205F")));
michael@0 275 } else {
michael@0 276 if (1/Number("\u205F") !== Number.POSITIVE_INFINITY) {
michael@0 277 $ERROR('#30.2: Number("\\u205F") === +0. Actual: -0');
michael@0 278 }
michael@0 279 }
michael@0 280
michael@0 281 // CHECK#31
michael@0 282 if (Number("\u3000") !== 0) {
michael@0 283 $ERROR('#31.1: Number("\\u3000") === 0. Actual: ' + (Number("\u3000")));
michael@0 284 } else {
michael@0 285 if (1/Number("\u3000") !== Number.POSITIVE_INFINITY) {
michael@0 286 $ERROR('#31.2: Number("\\u3000") === +0. Actual: -0');
michael@0 287 }
michael@0 288 }
michael@0 289

mercurial