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 24KDE JS Test 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS !undefined is true 30PASS !null is true 31PASS !!true is true 32PASS !false is true 33PASS !!1 is true 34PASS !0 is true 35PASS !!'a' is true 36PASS !'' is true 37PASS nonSpeculativeNot(undefined) is true 38PASS nonSpeculativeNot(null) is true 39PASS nonSpeculativeNot(!true) is true 40PASS nonSpeculativeNot(false) is true 41PASS nonSpeculativeNot(!1) is true 42PASS nonSpeculativeNot(0) is true 43PASS nonSpeculativeNot(!'a') is true 44PASS nonSpeculativeNot('') is true 45PASS +9 is 9 46PASS var i = 10; +i is 10 47PASS -11 is -11 48PASS var i = 12; -i is -12 49PASS var i = 0; ++i; is 1 50PASS var i = 0; ++i; i is 1 51PASS var i = 0; i++; is 0 52PASS var i = 0; i++; i is 1 53PASS var i = true; i++ is 1 54PASS var i = true; i++; i is 2 55PASS var i = 0; --i; is -1 56PASS var i = 0; --i; i is -1 57PASS var i = 0; i--; is 0 58PASS var i = 0; i--; i is -1 59PASS var i = true; i-- is 1 60PASS var i = true; i--; i is 0 61PASS ~0 is -1 62PASS ~1 is -2 63PASS ~NaN is -1 64PASS ~Infinity is -1 65PASS ~Math.pow(2, 33) is -1 66PASS ~(Math.pow(2, 32) + Math.pow(2, 31) + 2) is 2147483645 67PASS ~null is -1 68PASS 3 & 1 is 1 69PASS 2 | true is 3 70PASS '3' ^ 1 is 2 71PASS 3^4&5 is 7 72PASS 2|4^5 is 3 73PASS 1 << 2 is 4 74PASS 8 >> 1 is 4 75PASS 1 >> 2 is 0 76PASS -8 >> 24 is -1 77PASS 8 >>> 2 is 2 78PASS -8 >>> 24 is 255 79PASS (-2200000000 >> 1) << 1 is 2094967296 80PASS Infinity >> 1 is 0 81PASS Infinity << 1 is 0 82PASS Infinity >>> 1 is 0 83PASS NaN >> 1 is 0 84PASS NaN << 1 is 0 85PASS NaN >>> 1 is 0 86PASS 8.1 >> 1 is 4 87PASS 8.1 << 1 is 16 88PASS 8.1 >>> 1 is 4 89PASS 8.9 >> 1 is 4 90PASS 8.9 << 1 is 16 91PASS 8.9 >>> 1 is 4 92PASS Math.pow(2, 32) >> 1 is 0 93PASS Math.pow(2, 32) << 1 is 0 94PASS Math.pow(2, 32) >>> 1 is 0 95PASS 1 << two is 4 96PASS 8 >> one is 4 97PASS 1 >> two is 0 98PASS -8 >> twentyFour is -1 99PASS 8 >>> two is 2 100PASS -8 >>> twentyFour is 255 101PASS (-2200000000 >> one) << one is 2094967296 102PASS Infinity >> one is 0 103PASS Infinity << one is 0 104PASS Infinity >>> one is 0 105PASS NaN >> one is 0 106PASS NaN << one is 0 107PASS NaN >>> one is 0 108PASS 888.1 >> one is 444 109PASS 888.1 << one is 1776 110PASS 888.1 >>> one is 444 111PASS 888.9 >> one is 444 112PASS 888.9 << one is 1776 113PASS 888.9 >>> one is 444 114PASS Math.pow(2, 32) >> one is 0 115PASS Math.pow(2, 32) << one is 0 116PASS Math.pow(2, 32) >>> one is 0 117PASS 1+2 is 3 118PASS 'a'+'b' is 'ab' 119PASS 'a'+2 is 'a2' 120PASS '2'+'-1' is '2-1' 121PASS true+'a' is 'truea' 122PASS 'a' + null is 'anull' 123PASS true+1 is 2 124PASS false+null is 0 125PASS 1-3 is -2 126PASS isNaN('a'-3) is true 127PASS '3'-'-1' is 4 128PASS '4'-2 is 2 129PASS true-false is 1 130PASS false-1 is -1 131PASS null-true is -1 132PASS 2 * 3 is 6 133PASS true * 3 is 3 134PASS 2 * '3' is 6 135PASS 6 / 4 is 1.5 136PASS '6' / '2' is 3 137PASS isNaN('x' / 1) is true 138PASS isNaN(1 / NaN) is true 139PASS isNaN(Infinity / Infinity) is true 140PASS Infinity / 0 is Infinity 141PASS -Infinity / 0 is -Infinity 142PASS Infinity / 1 is Infinity 143PASS -Infinity / 1 is -Infinity 144PASS 1 / Infinity == +0 is true 145PASS 1 / -Infinity == -0 is true 146PASS isNaN(0/0) is true 147PASS 0 / 1 === 0 is true 148PASS 0 / -1 === -0 is true 149PASS 1 / 0 is Infinity 150PASS -1 / 0 is -Infinity 151PASS 6 % 4 is 2 152PASS '-6' % 4 is -2 153PASS 2==2 is true 154PASS 1==2 is false 155PASS nonSpeculativeEqual(2,2) is true 156PASS nonSpeculativeEqual(1,2) is false 157PASS 1<2 is true 158PASS 1<=2 is true 159PASS 2<1 is false 160PASS 2<=1 is false 161PASS nonSpeculativeLess(1,2) is true 162PASS nonSpeculativeLessEq(1,2) is true 163PASS nonSpeculativeLess(2,1) is false 164PASS nonSpeculativeLessEq(2,1) is false 165PASS 2>1 is true 166PASS 2>=1 is true 167PASS 1>=2 is false 168PASS 1>2 is false 169PASS nonSpeculativeGreater(2,1) is true 170PASS nonSpeculativeGreaterEq(2,1) is true 171PASS nonSpeculativeGreaterEq(1,2) is false 172PASS nonSpeculativeGreater(1,2) is false 173PASS 'abc' == 'abc' is true 174PASS 'abc' != 'xyz' is true 175PASS true == true is true 176PASS false == false is true 177PASS true != false is true 178PASS 'a' != null is true 179PASS 'a' != undefined is true 180PASS null == null is true 181PASS null == undefined is true 182PASS undefined == undefined is true 183PASS NaN != NaN is true 184PASS true != undefined is true 185PASS true != null is true 186PASS false != undefined is true 187PASS false != null is true 188PASS '0' == 0 is true 189PASS 1 == '1' is true 190PASS NaN != NaN is true 191PASS NaN != 0 is true 192PASS NaN != undefined is true 193PASS true == 1 is true 194PASS true != 2 is true 195PASS 1 == true is true 196PASS false == 0 is true 197PASS 0 == false is true 198PASS nonSpeculativeEqual('abc', 'abc') is true 199PASS nonSpeculativeNotEqual('abc', 'xyz') is true 200PASS nonSpeculativeEqual(true, true) is true 201PASS nonSpeculativeEqual(false, false) is true 202PASS nonSpeculativeNotEqual(true, false) is true 203PASS nonSpeculativeNotEqual('a', null) is true 204PASS nonSpeculativeNotEqual('a', undefined) is true 205PASS nonSpeculativeEqual(null, null) is true 206PASS nonSpeculativeEqual(null, undefined) is true 207PASS nonSpeculativeEqual(undefined, undefined) is true 208PASS nonSpeculativeNotEqual(NaN, NaN) is true 209PASS nonSpeculativeNotEqual(true, undefined) is true 210PASS nonSpeculativeNotEqual(true, null) is true 211PASS nonSpeculativeNotEqual(false, undefined) is true 212PASS nonSpeculativeNotEqual(false, null) is true 213PASS nonSpeculativeEqual('0', 0) is true 214PASS nonSpeculativeEqual(1, '1') is true 215PASS nonSpeculativeNotEqual(NaN, NaN) is true 216PASS nonSpeculativeNotEqual(NaN, 0) is true 217PASS nonSpeculativeNotEqual(NaN, undefined) is true 218PASS nonSpeculativeEqual(true, 1) is true 219PASS nonSpeculativeNotEqual(true, 2) is true 220PASS nonSpeculativeEqual(1, true) is true 221PASS nonSpeculativeEqual(false, 0) is true 222PASS nonSpeculativeEqual(0, false) is true 223PASS 'abc' < 'abx' is true 224PASS 'abc' < 'abcd' is true 225PASS 'abc' < 'abc' is false 226PASS 'abcd' < 'abcd' is false 227PASS 'abx' < 'abc' is false 228PASS nonSpeculativeLess('abc', 'abx') is true 229PASS nonSpeculativeLess('abc', 'abcd') is true 230PASS nonSpeculativeLess('abc', 'abc') is false 231PASS nonSpeculativeLess('abcd', 'abcd') is false 232PASS nonSpeculativeLess('abx', 'abc') is false 233PASS 'abc' <= 'abc' is true 234PASS 'abc' <= 'abx' is true 235PASS 'abx' <= 'abc' is false 236PASS 'abcd' <= 'abc' is false 237PASS 'abc' <= 'abcd' is true 238PASS nonSpeculativeLessEq('abc', 'abc') is true 239PASS nonSpeculativeLessEq('abc', 'abx') is true 240PASS nonSpeculativeLessEq('abx', 'abc') is false 241PASS nonSpeculativeLessEq('abcd', 'abc') is false 242PASS nonSpeculativeLessEq('abc', 'abcd') is true 243PASS 'abc' > 'abx' is false 244PASS 'abc' > 'abc' is false 245PASS 'abcd' > 'abc' is true 246PASS 'abx' > 'abc' is true 247PASS 'abc' > 'abcd' is false 248PASS nonSpeculativeGreater('abc', 'abx') is false 249PASS nonSpeculativeGreater('abc', 'abc') is false 250PASS nonSpeculativeGreater('abcd', 'abc') is true 251PASS nonSpeculativeGreater('abx', 'abc') is true 252PASS nonSpeculativeGreater('abc', 'abcd') is false 253PASS 'abc' >= 'abc' is true 254PASS 'abcd' >= 'abc' is true 255PASS 'abx' >= 'abc' is true 256PASS 'abc' >= 'abx' is false 257PASS 'abc' >= 'abx' is false 258PASS 'abc' >= 'abcd' is false 259PASS nonSpeculativeGreaterEq('abc', 'abc') is true 260PASS nonSpeculativeGreaterEq('abcd', 'abc') is true 261PASS nonSpeculativeGreaterEq('abx', 'abc') is true 262PASS nonSpeculativeGreaterEq('abc', 'abx') is false 263PASS nonSpeculativeGreaterEq('abc', 'abx') is false 264PASS nonSpeculativeGreaterEq('abc', 'abcd') is false 265PASS 'abc' <= 0 is false 266PASS '' <= 0 is true 267PASS ' ' <= 0 is true 268PASS null <= 0 is true 269PASS 0 <= 'abc' is false 270PASS 0 <= '' is true 271PASS 0 <= null is true 272PASS null <= null is true 273PASS 6 < '52' is true 274PASS 6 < '72' is true 275PASS NaN < 0 is false 276PASS NaN <= 0 is false 277PASS NaN > 0 is false 278PASS NaN >= 0 is false 279PASS nonSpeculativeLessEq('abc', 0) is false 280PASS nonSpeculativeLessEq('', 0) is true 281PASS nonSpeculativeLessEq(' ', 0) is true 282PASS nonSpeculativeLessEq(null, 0) is true 283PASS nonSpeculativeLessEq(0, 'abc') is false 284PASS nonSpeculativeLessEq(0, '') is true 285PASS nonSpeculativeLessEq(0, null) is true 286PASS nonSpeculativeLessEq(null, null) is true 287PASS nonSpeculativeLess(6, '52') is true 288PASS nonSpeculativeLess(6, '72') is true 289PASS nonSpeculativeLess(NaN, 0) is false 290PASS nonSpeculativeLessEq(NaN, 0) is false 291PASS nonSpeculativeGreater(NaN, 0) is false 292PASS nonSpeculativeGreaterEq(NaN, 0) is false 293PASS 0 === false is false 294PASS null === null is true 295PASS NaN === NaN is false 296PASS 0.0 === 0 is true 297PASS 'abc' === 'abc' is true 298PASS 'a' === 'x' is false 299PASS 1 === '1' is false 300PASS '1' === 1 is false 301PASS true === true is true 302PASS false === false is true 303PASS true === false is false 304PASS Math === Math is true 305PASS Math === Boolean is false 306PASS Infinity === Infinity is true 307PASS nonSpeculativeStrictEqual(0, false) is false 308PASS nonSpeculativeStrictEqual(null, null) is true 309PASS nonSpeculativeStrictEqual(NaN, NaN) is false 310PASS nonSpeculativeStrictEqual(0.0, 0) is true 311PASS nonSpeculativeStrictEqual('abc', 'abc') is true 312PASS nonSpeculativeStrictEqual('a', 'x') is false 313PASS nonSpeculativeStrictEqual(1, '1') is false 314PASS nonSpeculativeStrictEqual('1', 1) is false 315PASS nonSpeculativeStrictEqual(true, true) is true 316PASS nonSpeculativeStrictEqual(false, false) is true 317PASS nonSpeculativeStrictEqual(true, false) is false 318PASS nonSpeculativeStrictEqual(Math, Math) is true 319PASS nonSpeculativeStrictEqual(Math, Boolean) is false 320PASS nonSpeculativeStrictEqual(Infinity, Infinity) is true 321PASS 0 !== 0 is false 322PASS 0 !== 1 is true 323PASS nonSpeculativeStrictNotEqual(0, 0) is false 324PASS nonSpeculativeStrictNotEqual(0, 1) is true 325PASS typeof undefined is 'undefined' 326PASS typeof null is 'object' 327PASS typeof true is 'boolean' 328PASS typeof false is 'boolean' 329PASS typeof 1 is 'number' 330PASS typeof 'a' is 'string' 331PASS typeof shouldBe is 'function' 332PASS typeof Number.NaN is 'number' 333PASS 11 && 22 is 22 334PASS null && true is null 335PASS 11 || 22 is 11 336PASS null || 'a' is 'a' 337PASS void 1 is undefined. 338PASS 1 in [1, 2] is true 339PASS 3 in [1, 2] is false 340PASS 'a' in { a:1, b:2 } is true 341PASS (new Boolean()) instanceof Boolean is true 342PASS (new Boolean()) instanceof Number is false 343PASS successfullyParsed is true 344 345TEST COMPLETE 346 347