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 ensures that NaN is handled correctly when converting numeric expressions to booleans. 25 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29 PASS NaN ? true : false is false 30 PASS 1 ? true : false is true 31 PASS 0 ? true : false is false 32 PASS -1 ? true : false is true 33 PASS 1 * -1 ? true : false is true 34 PASS 1 * 0 ? true : false is false 35 PASS 1 * 1 ? true : false is true 36 PASS 1 / -1 ? true : false is true 37 PASS 1 / 0 ? true : false is true 38 PASS 1 / 1 ? true : false is true 39 PASS 1 % 2 ? true : false is true 40 PASS 1 % 1 ? true : false is false 41 PASS 1 + -1 ? true : false is false 42 PASS 1 + 0 ? true : false is true 43 PASS 1 + 1 ? true : false is true 44 PASS 1 - -1 ? true : false is true 45 PASS 1 - 0 ? true : false is true 46 PASS 1 - 1 ? true : false is false 47 PASS 1 & -1 ? true : false is true 48 PASS 1 & 0 ? true : false is false 49 PASS 1 & 1 ? true : false is true 50 PASS 1 | -1 ? true : false is true 51 PASS 1 | 0 ? true : false is true 52 PASS 1 | 1 ? true : false is true 53 PASS 1 ^ -1 ? true : false is true 54 PASS 1 ^ 0 ? true : false is true 55 PASS 1 ^ 1 ? true : false is false 56 PASS NaN * -1 ? true : false is false 57 PASS NaN * 0? true : false is false 58 PASS NaN * 1? true : false is false 59 PASS NaN / -1 ? true : false is false 60 PASS NaN / 0? true : false is false 61 PASS NaN / 1? true : false is false 62 PASS NaN % -1 ? true : false is false 63 PASS NaN % 0? true : false is false 64 PASS NaN % 1? true : false is false 65 PASS NaN + -1 ? true : false is false 66 PASS NaN + 0? true : false is false 67 PASS NaN + 1? true : false is false 68 PASS NaN - -1 ? true : false is false 69 PASS NaN - 0? true : false is false 70 PASS NaN - 1? true : false is false 71 PASS NaN & -1 ? true : false is false 72 PASS NaN & 0? true : false is false 73 PASS NaN & 1? true : false is false 74 PASS NaN | -1 ? true : false is true 75 PASS NaN | 0? true : false is false 76 PASS NaN | 1? true : false is true 77 PASS NaN ^ -1 ? true : false is true 78 PASS NaN ^ 0? true : false is false 79 PASS NaN ^ 1? true : false is true 80 PASS +NaN ? true : false is false 81 PASS -NaN ? true : false is false 82 PASS NaN && true ? true : false is false 83 PASS NaN && false ? true : false is false 84 PASS NaN || true ? true : false is true 85 PASS NaN || false ? true : false is false 86 PASS (function(){var nan = NaN; return nan-- ? true : false})() is false 87 PASS (function(){var nan = NaN; return nan++ ? true : false})() is false 88 PASS (function(){var nan = NaN; return --nan ? true : false})() is false 89 PASS (function(){var nan = NaN; return ++nan ? true : false})() is false 90 PASS (function(){var Undefined = undefined; return Undefined-- ? true : false})() is false 91 PASS (function(){var Undefined = undefined; return Undefined++ ? true : false})() is false 92 PASS (function(){var Undefined = undefined; return --Undefined ? true : false})() is false 93 PASS (function(){var Undefined = undefined; return ++Undefined ? true : false})() is false 94 PASS successfullyParsed is true 95 96 TEST COMPLETE 97 98