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 24This test checks some cases that might be affected by constant folding. 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS "abc" + "2.1" is "abc2.1" 30PASS "123" + "2.1" is "1232.1" 31PASS "123" + "=" is "123=" 32PASS "*" + "123" is "*123" 33PASS !"abc" is false 34PASS !"" is true 35PASS 10.3 + 2.1 is 12.4 36PASS 10.3 + "2.1" is "10.32.1" 37PASS "10.3" + 2.1 is "10.32.1" 38PASS "10.3" + "2.1" is "10.32.1" 39PASS 10.3 + true is 11.3 40PASS "10.3" + true is "10.3true" 41PASS 10.3 + false is 10.3 42PASS "10.3" + false is "10.3false" 43PASS true + 2.1 is 3.1 44PASS true + "2.1" is "true2.1" 45PASS false + 2.1 is 2.1 46PASS false + "2.1" is "false2.1" 47PASS 10.3 - 2.1 is 8.200000000000001 48PASS 10.3 - "2.1" is 8.200000000000001 49PASS "10.3" - 2.1 is 8.200000000000001 50PASS "10.3" - "2.1" is 8.200000000000001 51PASS 10.3 - true is 9.3 52PASS "10.3" - true is 9.3 53PASS 10.3 - false is 10.3 54PASS "10.3" - false is 10.3 55PASS true - 2.1 is -1.1 56PASS true - "2.1" is -1.1 57PASS false - 2.1 is -2.1 58PASS false - "2.1" is -2.1 59PASS 10.3 * 2.1 is 21.630000000000003 60PASS 10.3 * "2.1" is 21.630000000000003 61PASS "10.3" * 2.1 is 21.630000000000003 62PASS "10.3" * "2.1" is 21.630000000000003 63PASS 10.3 * true is 10.3 64PASS "10.3" * true is 10.3 65PASS 10.3 * false is 0 66PASS "10.3" * false is 0 67PASS true * 10.3 is 10.3 68PASS true * "10.3" is 10.3 69PASS false * 10.3 is 0 70PASS false * "10.3" is 0 71PASS 10.3 / 2 is 5.15 72PASS "10.3" / 2 is 5.15 73PASS 10.3 / "2" is 5.15 74PASS "10.3" / "2" is 5.15 75PASS 10.3 / true is 10.3 76PASS "10.3" / true is 10.3 77PASS true / 2 is 0.5 78PASS true / "2" is 0.5 79PASS false / 2 is 0 80PASS false / "2" is 0 81PASS 10.3 % 2.1 is 1.9000000000000004 82PASS "10.3" % 2.1 is 1.9000000000000004 83PASS 10.3 % "2.1" is 1.9000000000000004 84PASS "10.3" % "2.1" is 1.9000000000000004 85PASS 10.3 % true is 0.3000000000000007 86PASS "10.3" % true is 0.3000000000000007 87PASS true % 2 is 1 88PASS true % "2" is 1 89PASS false % 2 is 0 90PASS false % "2" is 0 91PASS 10.3 << 2.1 is 40 92PASS "10.3" << 2.1 is 40 93PASS 10.3 << "2.1" is 40 94PASS "10.3" << "2.1" is 40 95PASS 10.3 << true is 20 96PASS "10.3" << true is 20 97PASS 10.3 << false is 10 98PASS "10.3" << false is 10 99PASS true << 2.1 is 4 100PASS true << "2.1" is 4 101PASS false << 2.1 is 0 102PASS false << "2.1" is 0 103PASS 10.3 >> 2.1 is 2 104PASS "10.3" >> 2.1 is 2 105PASS 10.3 >> "2.1" is 2 106PASS "10.3" >> "2.1" is 2 107PASS 10.3 >> true is 5 108PASS "10.3" >> true is 5 109PASS 10.3 >> false is 10 110PASS "10.3" >> false is 10 111PASS true >> 2.1 is 0 112PASS true >> "2.1" is 0 113PASS false >> 2.1 is 0 114PASS false >> "2.1" is 0 115PASS -10.3 >>> 2.1 is 1073741821 116PASS "-10.3">>> 2.1 is 1073741821 117PASS -10.3 >>> "2.1" is 1073741821 118PASS "-10.3">>> "2.1" is 1073741821 119PASS -10.3 >>> true is 2147483643 120PASS "-10.3">>> true is 2147483643 121PASS -10.3 >>> false is 4294967286 122PASS "-10.3" >>> false is 4294967286 123PASS true >>> 2.1 is 0 124PASS true >>> "2.1" is 0 125PASS false >>> 2.1 is 0 126PASS false >>> "2.1" is 0 127PASS 10.3 & 3.1 is 2 128PASS "10.3" & 3.1 is 2 129PASS 10.3 & "3.1" is 2 130PASS "10.3" & "3.1" is 2 131PASS 10.3 & true is 0 132PASS "10.3" & true is 0 133PASS 11.3 & true is 1 134PASS "11.3" & true is 1 135PASS 10.3 & false is 0 136PASS "10.3" & false is 0 137PASS 11.3 & false is 0 138PASS "11.3" & false is 0 139PASS true & 3.1 is 1 140PASS true & "3.1" is 1 141PASS true & 2.1 is 0 142PASS true & "2.1" is 0 143PASS false & 3.1 is 0 144PASS false & "3.1" is 0 145PASS false & 2.1 is 0 146PASS false & "2.1" is 0 147PASS 10.3 | 3.1 is 11 148PASS "10.3" | 3.1 is 11 149PASS 10.3 | "3.1" is 11 150PASS "10.3" | "3.1" is 11 151PASS 10.3 | true is 11 152PASS "10.3" | true is 11 153PASS 11.3 | true is 11 154PASS "11.3" | true is 11 155PASS 10.3 | false is 10 156PASS "10.3" | false is 10 157PASS 11.3 | false is 11 158PASS "11.3" | false is 11 159PASS true | 3.1 is 3 160PASS true | "3.1" is 3 161PASS true | 2.1 is 3 162PASS true | "2.1" is 3 163PASS false | 3.1 is 3 164PASS false | "3.1" is 3 165PASS false | 2.1 is 2 166PASS false | "2.1" is 2 167PASS 10.3 ^ 3.1 is 9 168PASS "10.3" ^ 3.1 is 9 169PASS 10.3 ^ "3.1" is 9 170PASS "10.3" ^ "3.1" is 9 171PASS 10.3 ^ true is 11 172PASS "10.3" ^ true is 11 173PASS 11.3 ^ true is 10 174PASS "11.3" ^ true is 10 175PASS 10.3 ^ false is 10 176PASS "10.3" ^ false is 10 177PASS 11.3 ^ false is 11 178PASS "11.3" ^ false is 11 179PASS true ^ 3.1 is 2 180PASS true ^ "3.1" is 2 181PASS true ^ 2.1 is 3 182PASS true ^ "2.1" is 3 183PASS false ^ 3.1 is 3 184PASS false ^ "3.1" is 3 185PASS false ^ 2.1 is 2 186PASS false ^ "2.1" is 2 187PASS 10.3 == 3.1 is false 188PASS 3.1 == 3.1 is true 189PASS "10.3" == 3.1 is false 190PASS "3.1" == 3.1 is true 191PASS 10.3 == "3.1" is false 192PASS 3.1 == "3.1" is true 193PASS "10.3" == "3.1" is false 194PASS "3.1" == "3.1" is true 195PASS 10.3 == true is false 196PASS 1 == true is true 197PASS "10.3" == true is false 198PASS "1" == true is true 199PASS 10.3 == false is false 200PASS 0 == false is true 201PASS "10.3" == false is false 202PASS "0" == false is true 203PASS true == 3.1 is false 204PASS true == 1 is true 205PASS true == "3.1" is false 206PASS true == "1" is true 207PASS false == 3.1 is false 208PASS false == 0 is true 209PASS false == "3.1" is false 210PASS false == "0" is true 211PASS true == true is true 212PASS false == true is false 213PASS true == false is false 214PASS false == false is true 215PASS 10.3 != 3.1 is true 216PASS 3.1 != 3.1 is false 217PASS "10.3" != 3.1 is true 218PASS "3.1" != 3.1 is false 219PASS 10.3 != "3.1" is true 220PASS 3.1 != "3.1" is false 221PASS "10.3" != "3.1" is true 222PASS "3.1" != "3.1" is false 223PASS 10.3 != true is true 224PASS 1 != true is false 225PASS "10.3" != true is true 226PASS "1" != true is false 227PASS 10.3 != false is true 228PASS 0 != false is false 229PASS "10.3" != false is true 230PASS "0" != false is false 231PASS true != 3.1 is true 232PASS true != 1 is false 233PASS true != "3.1" is true 234PASS true != "1" is false 235PASS false != 3.1 is true 236PASS false != 0 is false 237PASS false != "3.1" is true 238PASS false != "0" is false 239PASS true != true is false 240PASS false != true is true 241PASS true != false is true 242PASS false != false is false 243PASS 10.3 > 3.1 is true 244PASS 3.1 > 3.1 is false 245PASS "10.3" > 3.1 is true 246PASS "3.1" > 3.1 is false 247PASS 10.3 > "3.1" is true 248PASS 3.1 > "3.1" is false 249PASS "10.3" > "3.1" is false 250PASS "3.1" > "3.1" is false 251PASS 10.3 > true is true 252PASS 0 > true is false 253PASS "10.3" > true is true 254PASS "0" > true is false 255PASS 10.3 > false is true 256PASS -1 > false is false 257PASS "10.3" > false is true 258PASS "-1" > false is false 259PASS true > 0.1 is true 260PASS true > 1.1 is false 261PASS true > "0.1" is true 262PASS true > "1.1" is false 263PASS false > -3.1 is true 264PASS false > 0 is false 265PASS false > "-3.1" is true 266PASS false > "0" is false 267PASS true > true is false 268PASS false > true is false 269PASS true > false is true 270PASS false > false is false 271PASS 10.3 < 3.1 is false 272PASS 2.1 < 3.1 is true 273PASS "10.3" < 3.1 is false 274PASS "2.1" < 3.1 is true 275PASS 10.3 < "3.1" is false 276PASS 2.1 < "3.1" is true 277PASS "10.3" < "3.1" is true 278PASS "2.1" < "3.1" is true 279PASS 10.3 < true is false 280PASS 0 < true is true 281PASS "10.3" < true is false 282PASS "0" < true is true 283PASS 10.3 < false is false 284PASS -1 < false is true 285PASS "10.3" < false is false 286PASS "-1" < false is true 287PASS true < 0.1 is false 288PASS true < 1.1 is true 289PASS true < "0.1" is false 290PASS true < "1.1" is true 291PASS false < -3.1 is false 292PASS false < 0.1 is true 293PASS false < "-3.1" is false 294PASS false < "0.1" is true 295PASS true < true is false 296PASS false < true is true 297PASS true < false is false 298PASS false < false is false 299PASS 10.3 >= 3.1 is true 300PASS 2.1 >= 3.1 is false 301PASS "10.3" >= 3.1 is true 302PASS "2.1" >= 3.1 is false 303PASS 10.3 >= "3.1" is true 304PASS 2.1 >= "3.1" is false 305PASS "10.3" >= "3.1" is false 306PASS "2.1" >= "3.1" is false 307PASS 10.3 >= true is true 308PASS 0 >= true is false 309PASS "10.3" >= true is true 310PASS "0" >= true is false 311PASS 10.3 >= false is true 312PASS -1 >= false is false 313PASS "10.3" >= false is true 314PASS "-1" >= false is false 315PASS true >= 0.1 is true 316PASS true >= 1.1 is false 317PASS true >= "0.1" is true 318PASS true >= "1.1" is false 319PASS false >= -3.1 is true 320PASS false >= 0 is true 321PASS false >= "-3.1" is true 322PASS false >= "0" is true 323PASS true >= true is true 324PASS false >= true is false 325PASS true >= false is true 326PASS false >= false is true 327PASS 10.3 <= 3.1 is false 328PASS 2.1 <= 3.1 is true 329PASS "10.3" <= 3.1 is false 330PASS "2.1" <= 3.1 is true 331PASS 10.3 <= "3.1" is false 332PASS 2.1 <= "3.1" is true 333PASS "10.3" <= "3.1" is true 334PASS "2.1" <= "3.1" is true 335PASS 10.3 <= true is false 336PASS 0 <= true is true 337PASS "10.3" <= true is false 338PASS "0" <= true is true 339PASS 10.3 <= false is false 340PASS -1 <= false is true 341PASS "10.3" <= false is false 342PASS "-1" <= false is true 343PASS true <= 0.1 is false 344PASS true <= 1.1 is true 345PASS true <= "0.1" is false 346PASS true <= "1.1" is true 347PASS false <= -3.1 is false 348PASS false <= 0.1 is true 349PASS false <= "-3.1" is false 350PASS false <= "0.1" is true 351PASS true <= true is true 352PASS false <= true is true 353PASS true <= false is false 354PASS false <= false is true 355PASS true && true is true 356PASS true && false is false 357PASS false && true is false 358PASS false && false is false 359PASS 1.1 && true is true 360PASS 1.1 && false is false 361PASS 0 && true is 0 362PASS 0 && false is 0 363PASS "1.1" && true is true 364PASS "1.1" && false is false 365PASS "0" && true is true 366PASS "0" && false is false 367PASS true && 1.1 is 1.1 368PASS true && 0 is 0 369PASS false && 1.1 is false 370PASS false && 0 is false 371PASS true && "1.1" is "1.1" 372PASS true && "0" is "0" 373PASS false && "1.1" is false 374PASS false && "0" is false 375PASS 1.1 && 1.1 is 1.1 376PASS 1.1 && 0 is 0 377PASS 0 && 1.1 is 0 378PASS 0 && 0 is 0 379PASS "1.1" && 1.1 is 1.1 380PASS "1.1" && 0 is 0 381PASS "0" && 1.1 is 1.1 382PASS "0" && 0 is 0 383PASS 1.1 && "1.1" is "1.1" 384PASS 1.1 && "0" is "0" 385PASS 0 && "1.1" is 0 386PASS 0 && "0" is 0 387PASS "1.1" && "1.1" is "1.1" 388PASS "1.1" && "0" is "0" 389PASS "0" && "1.1" is "1.1" 390PASS "0" && "0" is "0" 391PASS true || true is true 392PASS true || false is true 393PASS false || true is true 394PASS false || false is false 395PASS 1.1 || true is 1.1 396PASS 1.1 || false is 1.1 397PASS 0 || true is true 398PASS 0 || false is false 399PASS "1.1" || true is "1.1" 400PASS "1.1" || false is "1.1" 401PASS "0" || true is "0" 402PASS "0" || false is "0" 403PASS true || 1.1 is true 404PASS true || 0 is true 405PASS false || 1.1 is 1.1 406PASS false || 0 is 0 407PASS true || "1.1" is true 408PASS true || "0" is true 409PASS false || "1.1" is "1.1" 410PASS false || "0" is "0" 411PASS 1.1 || 1.1 is 1.1 412PASS 1.1 || 0 is 1.1 413PASS 0 || 1.1 is 1.1 414PASS 0 || 0 is 0 415PASS "1.1" || 1.1 is "1.1" 416PASS "1.1" || 0 is "1.1" 417PASS "0" || 1.1 is "0" 418PASS "0" || 0 is "0" 419PASS 1.1 || "1.1" is 1.1 420PASS 1.1 || "0" is 1.1 421PASS 0 || "1.1" is "1.1" 422PASS 0 || "0" is "0" 423PASS "1.1" || "1.1" is "1.1" 424PASS "1.1" || "0" is "1.1" 425PASS "0" || "1.1" is "0" 426PASS "0" || "0" is "0" 427PASS +3.1 is 3.1 428PASS + +3.1 is 3.1 429PASS +"3.1" is 3.1 430PASS +true is 1 431PASS +false is 0 432PASS -3.1 is -3.1 433PASS - -3.1 is 3.1 434PASS -"3.1" is -3.1 435PASS -true is -1 436PASS -false is -0 437PASS ~3 is -4 438PASS ~ ~3 is 3 439PASS ~"3" is -4 440PASS ~true is -2 441PASS ~false is -1 442PASS !true is false 443PASS !false is true 444PASS !3 is false 445PASS !0 is true 446PASS 10.3 / 0 is Infinity 447PASS "10.3" / 0 is Infinity 448PASS -10.3 / 0 is -Infinity 449PASS "-10.3" / 0 is -Infinity 450PASS true / 0 is Infinity 451PASS false / 0 is NaN 452PASS 0 / 0 is NaN 453PASS 10.3 / -0 is -Infinity 454PASS "10.3" / -0 is -Infinity 455PASS -10.3 / -0 is Infinity 456PASS "-10.3" / -0 is Infinity 457PASS true / -0 is -Infinity 458PASS false / -0 is NaN 459PASS 0 / -0 is NaN 460PASS 1 / -0 is -Infinity 461PASS 1 / - 0 is -Infinity 462PASS 1 / - -0 is Infinity 463PASS 1 / - - -0 is -Infinity 464PASS successfullyParsed is true 465 466TEST COMPLETE 467 468