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

Side by Side Diff: test/mjsunit/compare-constants.js

Issue 21246: Add unit test for comparison of smi constants, loops, and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 // Test comparison operations that involve one or two constant Smis.
29
30
31 function foo() {
32 var i = 5;
33 var j = 3;
34
35 assertTrue( j < i );
36 i = 5; j = 3;
37 assertTrue( j <= i );
38 i = 5; j = 3;
39 assertTrue( i > j );
40 i = 5; j = 3;
41 assertTrue( i >= j );
42 i = 5; j = 3;
43 assertTrue( i != j );
44 i = 5; j = 3;
45 assertTrue( i == i );
46 i = 5; j = 3;
47 assertFalse( i < j );
48 i = 5; j = 3;
49 assertFalse( i <= j );
50 i = 5; j = 3;
51 assertFalse( j > i );
52 i = 5; j = 3;
53 assertFalse(j >= i );
54 i = 5; j = 3;
55 assertFalse( j == i);
56 i = 5; j = 3;
57 assertFalse( i != i);
58
59 i = 10 * 10;
60 while ( i < 107 ) {
61 ++i;
62 }
63 j = 21;
64
65
66 assertTrue( j < i );
67 j = 21;
68 assertTrue( j <= i );
69 j = 21;
70 assertTrue( i > j );
71 j = 21;
72 assertTrue( i >= j );
73 j = 21;
74 assertTrue( i != j );
75 j = 21;
76 assertTrue( i == i );
77 j = 21;
78 assertFalse( i < j );
79 j = 21;
80 assertFalse( i <= j );
81 j = 21;
82 assertFalse( j > i );
83 j = 21;
84 assertFalse(j >= i );
85 j = 21;
86 assertFalse( j == i);
87 j = 21;
88 assertFalse( i != i);
89 j = 21;
90 assertTrue( j == j );
91 j = 21;
92 assertFalse( j != j );
93
94 assertTrue( 100 > 99 );
95 assertTrue( 101 >= 90 );
96 assertTrue( 11111 > -234 );
97 assertTrue( -888 <= -20 );
98
99 while ( 234 > 456 ) {
100 i = i + 1;
101 }
102
103 switch(3) {
104 case 5:
105 assertUnreachable();
106 break;
107 case 3:
108 j = 13;
109 default:
110 i = 2;
111 case 7:
112 j = 17;
113 break;
114 case 9:
115 j = 19;
116 assertUnreachable();
117 break;
118 }
119 assertEquals(17, j, "switch with constant value");
120 }
121
122 foo();
123
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698