Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: test/webkit/convert-nan-to-bool.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 AN Y
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 AN Y
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 O N
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 description("This test ensures that NaN is handled correctly when converting num eric expressions to booleans.");
25
26 shouldBe("NaN ? true : false", "false");
27 shouldBe("1 ? true : false", "true");
28 shouldBe("0 ? true : false", "false");
29 shouldBe("-1 ? true : false", "true");
30 shouldBe("1 * -1 ? true : false", "true");
31 shouldBe("1 * 0 ? true : false", "false");
32 shouldBe("1 * 1 ? true : false", "true");
33 shouldBe("1 / -1 ? true : false", "true");
34 shouldBe("1 / 0 ? true : false", "true");
35 shouldBe("1 / 1 ? true : false", "true");
36 shouldBe("1 % 2 ? true : false", "true");
37 shouldBe("1 % 1 ? true : false", "false");
38 shouldBe("1 + -1 ? true : false", "false");
39 shouldBe("1 + 0 ? true : false", "true");
40 shouldBe("1 + 1 ? true : false", "true");
41 shouldBe("1 - -1 ? true : false", "true");
42 shouldBe("1 - 0 ? true : false", "true");
43 shouldBe("1 - 1 ? true : false", "false");
44 shouldBe("1 & -1 ? true : false", "true");
45 shouldBe("1 & 0 ? true : false", "false");
46 shouldBe("1 & 1 ? true : false", "true");
47 shouldBe("1 | -1 ? true : false", "true");
48 shouldBe("1 | 0 ? true : false", "true");
49 shouldBe("1 | 1 ? true : false", "true");
50 shouldBe("1 ^ -1 ? true : false", "true");
51 shouldBe("1 ^ 0 ? true : false", "true");
52 shouldBe("1 ^ 1 ? true : false", "false");
53 shouldBe("NaN * -1 ? true : false", "false");
54 shouldBe("NaN * 0? true : false", "false");
55 shouldBe("NaN * 1? true : false", "false");
56 shouldBe("NaN / -1 ? true : false", "false");
57 shouldBe("NaN / 0? true : false", "false");
58 shouldBe("NaN / 1? true : false", "false");
59 shouldBe("NaN % -1 ? true : false", "false");
60 shouldBe("NaN % 0? true : false", "false");
61 shouldBe("NaN % 1? true : false", "false");
62 shouldBe("NaN + -1 ? true : false", "false");
63 shouldBe("NaN + 0? true : false", "false");
64 shouldBe("NaN + 1? true : false", "false");
65 shouldBe("NaN - -1 ? true : false", "false");
66 shouldBe("NaN - 0? true : false", "false");
67 shouldBe("NaN - 1? true : false", "false");
68 shouldBe("NaN & -1 ? true : false", "false");
69 shouldBe("NaN & 0? true : false", "false");
70 shouldBe("NaN & 1? true : false", "false");
71 shouldBe("NaN | -1 ? true : false", "true");
72 shouldBe("NaN | 0? true : false", "false");
73 shouldBe("NaN | 1? true : false", "true");
74 shouldBe("NaN ^ -1 ? true : false", "true");
75 shouldBe("NaN ^ 0? true : false", "false");
76 shouldBe("NaN ^ 1? true : false", "true");
77 shouldBe("+NaN ? true : false", "false");
78 shouldBe("-NaN ? true : false", "false");
79 shouldBe("NaN && true ? true : false", "false");
80 shouldBe("NaN && false ? true : false", "false");
81 shouldBe("NaN || true ? true : false", "true");
82 shouldBe("NaN || false ? true : false", "false");
83 shouldBe("(function(){var nan = NaN; return nan-- ? true : false})()", "false");
84 shouldBe("(function(){var nan = NaN; return nan++ ? true : false})()", "false");
85 shouldBe("(function(){var nan = NaN; return --nan ? true : false})()", "false");
86 shouldBe("(function(){var nan = NaN; return ++nan ? true : false})()", "false");
87 shouldBe("(function(){var Undefined = undefined; return Undefined-- ? true : fal se})()", "false");
88 shouldBe("(function(){var Undefined = undefined; return Undefined++ ? true : fal se})()", "false");
89 shouldBe("(function(){var Undefined = undefined; return --Undefined ? true : fal se})()", "false");
90 shouldBe("(function(){var Undefined = undefined; return ++Undefined ? true : fal se})()", "false");
OLDNEW
« no previous file with comments | « test/webkit/continue-break-multiple-labels-expected.txt ('k') | test/webkit/convert-nan-to-bool-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698