1 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 # 4 # Redistribution and use in source and binary forms, with or without 5 # modification, are permitted provided that the following conditions 6 # are met: 7 # 1. Redistributions of source code must retain the above copyright 8 # notice, this list of conditions and the following disclaimer. 9 # 2. Redistributions in binary form must reproduce the above copyright 10 # notice, this list of conditions and the following disclaimer in the 11 # documentation and/or other materials provided with the distribution. 12 # 13 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24 This test checks some cases that might be affected by constant folding. 25 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29 PASS "abc" + "2.1" is "abc2.1" 30 PASS "123" + "2.1" is "1232.1" 31 PASS "123" + "=" is "123=" 32 PASS "*" + "123" is "*123" 33 PASS !"abc" is false 34 PASS !"" is true 35 PASS 10.3 + 2.1 is 12.4 36 PASS 10.3 + "2.1" is "10.32.1" 37 PASS "10.3" + 2.1 is "10.32.1" 38 PASS "10.3" + "2.1" is "10.32.1" 39 PASS 10.3 + true is 11.3 40 PASS "10.3" + true is "10.3true" 41 PASS 10.3 + false is 10.3 42 PASS "10.3" + false is "10.3false" 43 PASS true + 2.1 is 3.1 44 PASS true + "2.1" is "true2.1" 45 PASS false + 2.1 is 2.1 46 PASS false + "2.1" is "false2.1" 47 PASS 10.3 - 2.1 is 8.200000000000001 48 PASS 10.3 - "2.1" is 8.200000000000001 49 PASS "10.3" - 2.1 is 8.200000000000001 50 PASS "10.3" - "2.1" is 8.200000000000001 51 PASS 10.3 - true is 9.3 52 PASS "10.3" - true is 9.3 53 PASS 10.3 - false is 10.3 54 PASS "10.3" - false is 10.3 55 PASS true - 2.1 is -1.1 56 PASS true - "2.1" is -1.1 57 PASS false - 2.1 is -2.1 58 PASS false - "2.1" is -2.1 59 PASS 10.3 * 2.1 is 21.630000000000003 60 PASS 10.3 * "2.1" is 21.630000000000003 61 PASS "10.3" * 2.1 is 21.630000000000003 62 PASS "10.3" * "2.1" is 21.630000000000003 63 PASS 10.3 * true is 10.3 64 PASS "10.3" * true is 10.3 65 PASS 10.3 * false is 0 66 PASS "10.3" * false is 0 67 PASS true * 10.3 is 10.3 68 PASS true * "10.3" is 10.3 69 PASS false * 10.3 is 0 70 PASS false * "10.3" is 0 71 PASS 10.3 / 2 is 5.15 72 PASS "10.3" / 2 is 5.15 73 PASS 10.3 / "2" is 5.15 74 PASS "10.3" / "2" is 5.15 75 PASS 10.3 / true is 10.3 76 PASS "10.3" / true is 10.3 77 PASS true / 2 is 0.5 78 PASS true / "2" is 0.5 79 PASS false / 2 is 0 80 PASS false / "2" is 0 81 PASS 10.3 % 2.1 is 1.9000000000000004 82 PASS "10.3" % 2.1 is 1.9000000000000004 83 PASS 10.3 % "2.1" is 1.9000000000000004 84 PASS "10.3" % "2.1" is 1.9000000000000004 85 PASS 10.3 % true is 0.3000000000000007 86 PASS "10.3" % true is 0.3000000000000007 87 PASS true % 2 is 1 88 PASS true % "2" is 1 89 PASS false % 2 is 0 90 PASS false % "2" is 0 91 PASS 10.3 << 2.1 is 40 92 PASS "10.3" << 2.1 is 40 93 PASS 10.3 << "2.1" is 40 94 PASS "10.3" << "2.1" is 40 95 PASS 10.3 << true is 20 96 PASS "10.3" << true is 20 97 PASS 10.3 << false is 10 98 PASS "10.3" << false is 10 99 PASS true << 2.1 is 4 100 PASS true << "2.1" is 4 101 PASS false << 2.1 is 0 102 PASS false << "2.1" is 0 103 PASS 10.3 >> 2.1 is 2 104 PASS "10.3" >> 2.1 is 2 105 PASS 10.3 >> "2.1" is 2 106 PASS "10.3" >> "2.1" is 2 107 PASS 10.3 >> true is 5 108 PASS "10.3" >> true is 5 109 PASS 10.3 >> false is 10 110 PASS "10.3" >> false is 10 111 PASS true >> 2.1 is 0 112 PASS true >> "2.1" is 0 113 PASS false >> 2.1 is 0 114 PASS false >> "2.1" is 0 115 PASS -10.3 >>> 2.1 is 1073741821 116 PASS "-10.3">>> 2.1 is 1073741821 117 PASS -10.3 >>> "2.1" is 1073741821 118 PASS "-10.3">>> "2.1" is 1073741821 119 PASS -10.3 >>> true is 2147483643 120 PASS "-10.3">>> true is 2147483643 121 PASS -10.3 >>> false is 4294967286 122 PASS "-10.3" >>> false is 4294967286 123 PASS true >>> 2.1 is 0 124 PASS true >>> "2.1" is 0 125 PASS false >>> 2.1 is 0 126 PASS false >>> "2.1" is 0 127 PASS 10.3 & 3.1 is 2 128 PASS "10.3" & 3.1 is 2 129 PASS 10.3 & "3.1" is 2 130 PASS "10.3" & "3.1" is 2 131 PASS 10.3 & true is 0 132 PASS "10.3" & true is 0 133 PASS 11.3 & true is 1 134 PASS "11.3" & true is 1 135 PASS 10.3 & false is 0 136 PASS "10.3" & false is 0 137 PASS 11.3 & false is 0 138 PASS "11.3" & false is 0 139 PASS true & 3.1 is 1 140 PASS true & "3.1" is 1 141 PASS true & 2.1 is 0 142 PASS true & "2.1" is 0 143 PASS false & 3.1 is 0 144 PASS false & "3.1" is 0 145 PASS false & 2.1 is 0 146 PASS false & "2.1" is 0 147 PASS 10.3 | 3.1 is 11 148 PASS "10.3" | 3.1 is 11 149 PASS 10.3 | "3.1" is 11 150 PASS "10.3" | "3.1" is 11 151 PASS 10.3 | true is 11 152 PASS "10.3" | true is 11 153 PASS 11.3 | true is 11 154 PASS "11.3" | true is 11 155 PASS 10.3 | false is 10 156 PASS "10.3" | false is 10 157 PASS 11.3 | false is 11 158 PASS "11.3" | false is 11 159 PASS true | 3.1 is 3 160 PASS true | "3.1" is 3 161 PASS true | 2.1 is 3 162 PASS true | "2.1" is 3 163 PASS false | 3.1 is 3 164 PASS false | "3.1" is 3 165 PASS false | 2.1 is 2 166 PASS false | "2.1" is 2 167 PASS 10.3 ^ 3.1 is 9 168 PASS "10.3" ^ 3.1 is 9 169 PASS 10.3 ^ "3.1" is 9 170 PASS "10.3" ^ "3.1" is 9 171 PASS 10.3 ^ true is 11 172 PASS "10.3" ^ true is 11 173 PASS 11.3 ^ true is 10 174 PASS "11.3" ^ true is 10 175 PASS 10.3 ^ false is 10 176 PASS "10.3" ^ false is 10 177 PASS 11.3 ^ false is 11 178 PASS "11.3" ^ false is 11 179 PASS true ^ 3.1 is 2 180 PASS true ^ "3.1" is 2 181 PASS true ^ 2.1 is 3 182 PASS true ^ "2.1" is 3 183 PASS false ^ 3.1 is 3 184 PASS false ^ "3.1" is 3 185 PASS false ^ 2.1 is 2 186 PASS false ^ "2.1" is 2 187 PASS 10.3 == 3.1 is false 188 PASS 3.1 == 3.1 is true 189 PASS "10.3" == 3.1 is false 190 PASS "3.1" == 3.1 is true 191 PASS 10.3 == "3.1" is false 192 PASS 3.1 == "3.1" is true 193 PASS "10.3" == "3.1" is false 194 PASS "3.1" == "3.1" is true 195 PASS 10.3 == true is false 196 PASS 1 == true is true 197 PASS "10.3" == true is false 198 PASS "1" == true is true 199 PASS 10.3 == false is false 200 PASS 0 == false is true 201 PASS "10.3" == false is false 202 PASS "0" == false is true 203 PASS true == 3.1 is false 204 PASS true == 1 is true 205 PASS true == "3.1" is false 206 PASS true == "1" is true 207 PASS false == 3.1 is false 208 PASS false == 0 is true 209 PASS false == "3.1" is false 210 PASS false == "0" is true 211 PASS true == true is true 212 PASS false == true is false 213 PASS true == false is false 214 PASS false == false is true 215 PASS 10.3 != 3.1 is true 216 PASS 3.1 != 3.1 is false 217 PASS "10.3" != 3.1 is true 218 PASS "3.1" != 3.1 is false 219 PASS 10.3 != "3.1" is true 220 PASS 3.1 != "3.1" is false 221 PASS "10.3" != "3.1" is true 222 PASS "3.1" != "3.1" is false 223 PASS 10.3 != true is true 224 PASS 1 != true is false 225 PASS "10.3" != true is true 226 PASS "1" != true is false 227 PASS 10.3 != false is true 228 PASS 0 != false is false 229 PASS "10.3" != false is true 230 PASS "0" != false is false 231 PASS true != 3.1 is true 232 PASS true != 1 is false 233 PASS true != "3.1" is true 234 PASS true != "1" is false 235 PASS false != 3.1 is true 236 PASS false != 0 is false 237 PASS false != "3.1" is true 238 PASS false != "0" is false 239 PASS true != true is false 240 PASS false != true is true 241 PASS true != false is true 242 PASS false != false is false 243 PASS 10.3 > 3.1 is true 244 PASS 3.1 > 3.1 is false 245 PASS "10.3" > 3.1 is true 246 PASS "3.1" > 3.1 is false 247 PASS 10.3 > "3.1" is true 248 PASS 3.1 > "3.1" is false 249 PASS "10.3" > "3.1" is false 250 PASS "3.1" > "3.1" is false 251 PASS 10.3 > true is true 252 PASS 0 > true is false 253 PASS "10.3" > true is true 254 PASS "0" > true is false 255 PASS 10.3 > false is true 256 PASS -1 > false is false 257 PASS "10.3" > false is true 258 PASS "-1" > false is false 259 PASS true > 0.1 is true 260 PASS true > 1.1 is false 261 PASS true > "0.1" is true 262 PASS true > "1.1" is false 263 PASS false > -3.1 is true 264 PASS false > 0 is false 265 PASS false > "-3.1" is true 266 PASS false > "0" is false 267 PASS true > true is false 268 PASS false > true is false 269 PASS true > false is true 270 PASS false > false is false 271 PASS 10.3 < 3.1 is false 272 PASS 2.1 < 3.1 is true 273 PASS "10.3" < 3.1 is false 274 PASS "2.1" < 3.1 is true 275 PASS 10.3 < "3.1" is false 276 PASS 2.1 < "3.1" is true 277 PASS "10.3" < "3.1" is true 278 PASS "2.1" < "3.1" is true 279 PASS 10.3 < true is false 280 PASS 0 < true is true 281 PASS "10.3" < true is false 282 PASS "0" < true is true 283 PASS 10.3 < false is false 284 PASS -1 < false is true 285 PASS "10.3" < false is false 286 PASS "-1" < false is true 287 PASS true < 0.1 is false 288 PASS true < 1.1 is true 289 PASS true < "0.1" is false 290 PASS true < "1.1" is true 291 PASS false < -3.1 is false 292 PASS false < 0.1 is true 293 PASS false < "-3.1" is false 294 PASS false < "0.1" is true 295 PASS true < true is false 296 PASS false < true is true 297 PASS true < false is false 298 PASS false < false is false 299 PASS 10.3 >= 3.1 is true 300 PASS 2.1 >= 3.1 is false 301 PASS "10.3" >= 3.1 is true 302 PASS "2.1" >= 3.1 is false 303 PASS 10.3 >= "3.1" is true 304 PASS 2.1 >= "3.1" is false 305 PASS "10.3" >= "3.1" is false 306 PASS "2.1" >= "3.1" is false 307 PASS 10.3 >= true is true 308 PASS 0 >= true is false 309 PASS "10.3" >= true is true 310 PASS "0" >= true is false 311 PASS 10.3 >= false is true 312 PASS -1 >= false is false 313 PASS "10.3" >= false is true 314 PASS "-1" >= false is false 315 PASS true >= 0.1 is true 316 PASS true >= 1.1 is false 317 PASS true >= "0.1" is true 318 PASS true >= "1.1" is false 319 PASS false >= -3.1 is true 320 PASS false >= 0 is true 321 PASS false >= "-3.1" is true 322 PASS false >= "0" is true 323 PASS true >= true is true 324 PASS false >= true is false 325 PASS true >= false is true 326 PASS false >= false is true 327 PASS 10.3 <= 3.1 is false 328 PASS 2.1 <= 3.1 is true 329 PASS "10.3" <= 3.1 is false 330 PASS "2.1" <= 3.1 is true 331 PASS 10.3 <= "3.1" is false 332 PASS 2.1 <= "3.1" is true 333 PASS "10.3" <= "3.1" is true 334 PASS "2.1" <= "3.1" is true 335 PASS 10.3 <= true is false 336 PASS 0 <= true is true 337 PASS "10.3" <= true is false 338 PASS "0" <= true is true 339 PASS 10.3 <= false is false 340 PASS -1 <= false is true 341 PASS "10.3" <= false is false 342 PASS "-1" <= false is true 343 PASS true <= 0.1 is false 344 PASS true <= 1.1 is true 345 PASS true <= "0.1" is false 346 PASS true <= "1.1" is true 347 PASS false <= -3.1 is false 348 PASS false <= 0.1 is true 349 PASS false <= "-3.1" is false 350 PASS false <= "0.1" is true 351 PASS true <= true is true 352 PASS false <= true is true 353 PASS true <= false is false 354 PASS false <= false is true 355 PASS true && true is true 356 PASS true && false is false 357 PASS false && true is false 358 PASS false && false is false 359 PASS 1.1 && true is true 360 PASS 1.1 && false is false 361 PASS 0 && true is 0 362 PASS 0 && false is 0 363 PASS "1.1" && true is true 364 PASS "1.1" && false is false 365 PASS "0" && true is true 366 PASS "0" && false is false 367 PASS true && 1.1 is 1.1 368 PASS true && 0 is 0 369 PASS false && 1.1 is false 370 PASS false && 0 is false 371 PASS true && "1.1" is "1.1" 372 PASS true && "0" is "0" 373 PASS false && "1.1" is false 374 PASS false && "0" is false 375 PASS 1.1 && 1.1 is 1.1 376 PASS 1.1 && 0 is 0 377 PASS 0 && 1.1 is 0 378 PASS 0 && 0 is 0 379 PASS "1.1" && 1.1 is 1.1 380 PASS "1.1" && 0 is 0 381 PASS "0" && 1.1 is 1.1 382 PASS "0" && 0 is 0 383 PASS 1.1 && "1.1" is "1.1" 384 PASS 1.1 && "0" is "0" 385 PASS 0 && "1.1" is 0 386 PASS 0 && "0" is 0 387 PASS "1.1" && "1.1" is "1.1" 388 PASS "1.1" && "0" is "0" 389 PASS "0" && "1.1" is "1.1" 390 PASS "0" && "0" is "0" 391 PASS true || true is true 392 PASS true || false is true 393 PASS false || true is true 394 PASS false || false is false 395 PASS 1.1 || true is 1.1 396 PASS 1.1 || false is 1.1 397 PASS 0 || true is true 398 PASS 0 || false is false 399 PASS "1.1" || true is "1.1" 400 PASS "1.1" || false is "1.1" 401 PASS "0" || true is "0" 402 PASS "0" || false is "0" 403 PASS true || 1.1 is true 404 PASS true || 0 is true 405 PASS false || 1.1 is 1.1 406 PASS false || 0 is 0 407 PASS true || "1.1" is true 408 PASS true || "0" is true 409 PASS false || "1.1" is "1.1" 410 PASS false || "0" is "0" 411 PASS 1.1 || 1.1 is 1.1 412 PASS 1.1 || 0 is 1.1 413 PASS 0 || 1.1 is 1.1 414 PASS 0 || 0 is 0 415 PASS "1.1" || 1.1 is "1.1" 416 PASS "1.1" || 0 is "1.1" 417 PASS "0" || 1.1 is "0" 418 PASS "0" || 0 is "0" 419 PASS 1.1 || "1.1" is 1.1 420 PASS 1.1 || "0" is 1.1 421 PASS 0 || "1.1" is "1.1" 422 PASS 0 || "0" is "0" 423 PASS "1.1" || "1.1" is "1.1" 424 PASS "1.1" || "0" is "1.1" 425 PASS "0" || "1.1" is "0" 426 PASS "0" || "0" is "0" 427 PASS +3.1 is 3.1 428 PASS + +3.1 is 3.1 429 PASS +"3.1" is 3.1 430 PASS +true is 1 431 PASS +false is 0 432 PASS -3.1 is -3.1 433 PASS - -3.1 is 3.1 434 PASS -"3.1" is -3.1 435 PASS -true is -1 436 PASS -false is -0 437 PASS ~3 is -4 438 PASS ~ ~3 is 3 439 PASS ~"3" is -4 440 PASS ~true is -2 441 PASS ~false is -1 442 PASS !true is false 443 PASS !false is true 444 PASS !3 is false 445 PASS !0 is true 446 PASS 10.3 / 0 is Infinity 447 PASS "10.3" / 0 is Infinity 448 PASS -10.3 / 0 is -Infinity 449 PASS "-10.3" / 0 is -Infinity 450 PASS true / 0 is Infinity 451 PASS false / 0 is NaN 452 PASS 0 / 0 is NaN 453 PASS 10.3 / -0 is -Infinity 454 PASS "10.3" / -0 is -Infinity 455 PASS -10.3 / -0 is Infinity 456 PASS "-10.3" / -0 is Infinity 457 PASS true / -0 is -Infinity 458 PASS false / -0 is NaN 459 PASS 0 / -0 is NaN 460 PASS 1 / -0 is -Infinity 461 PASS 1 / - 0 is -Infinity 462 PASS 1 / - -0 is Infinity 463 PASS 1 / - - -0 is -Infinity 464 PASS successfullyParsed is true 465 466 TEST COMPLETE 467 468