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

Side by Side Diff: tests/compiler/dart2js/value_range_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'compiler_helper.dart'; 5 import 'compiler_helper.dart';
6 6
7 const int REMOVED = 0; 7 const int REMOVED = 0;
8 const int ABOVE_ZERO = 1; 8 const int ABOVE_ZERO = 1;
9 const int BELOW_LENGTH = 2; 9 const int BELOW_LENGTH = 2;
10 const int KEPT = 3; 10 const int KEPT = 3;
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 return sum; 34 return sum;
35 } 35 }
36 """, 36 """,
37 ABOVE_ZERO, 37 ABOVE_ZERO,
38 38
39 """ 39 """
40 main(check) { 40 main(check) {
41 // Make sure value is an int. 41 // Make sure value is an int.
42 var value = check ? 42 : 54; 42 var value = check ? 42 : 54;
43 var a = new List(value); 43 var a = new List.fixedLength(value);
44 var sum = 0; 44 var sum = 0;
45 for (int i = 0; i < value; i++) { 45 for (int i = 0; i < value; i++) {
46 sum += a[i]; 46 sum += a[i];
47 } 47 }
48 return sum; 48 return sum;
49 } 49 }
50 """, 50 """,
51 REMOVED, 51 REMOVED,
52 52
53 """ 53 """
54 main() { 54 main() {
55 var a = new List(); 55 var a = new List();
56 return a[0]; 56 return a[0];
57 } 57 }
58 """, 58 """,
59 KEPT, 59 KEPT,
60 60
61 """ 61 """
62 main() { 62 main() {
63 var a = new List(); 63 var a = new List();
64 return a.removeLast(); 64 return a.removeLast();
65 } 65 }
66 """, 66 """,
67 KEPT, 67 KEPT,
68 68
69 """ 69 """
70 main() { 70 main() {
71 var a = new List(4); 71 var a = new List.fixedLength(4);
72 return a[0]; 72 return a[0];
73 } 73 }
74 """, 74 """,
75 REMOVED, 75 REMOVED,
76 76
77 """ 77 """
78 main() { 78 main() {
79 var a = new List(4); 79 var a = new List.fixedLength(4);
80 return a.removeLast(); 80 return a.removeLast();
81 } 81 }
82 """, 82 """,
83 REMOVED, 83 REMOVED,
84 84
85 """ 85 """
86 main(value) { 86 main(value) {
87 var a = new List(value); 87 var a = new List.fixedLength(value);
88 return a[value]; 88 return a[value];
89 } 89 }
90 """, 90 """,
91 KEPT, 91 KEPT,
92 92
93 """ 93 """
94 main(value) { 94 main(value) {
95 var a = new List(1024); 95 var a = new List.fixedLength(1024);
96 return a[1023 & value]; 96 return a[1023 & value];
97 } 97 }
98 """, 98 """,
99 REMOVED, 99 REMOVED,
100 100
101 """ 101 """
102 main(value) { 102 main(value) {
103 var a = new List(1024); 103 var a = new List.fixedLength(1024);
104 return a[1024 & value]; 104 return a[1024 & value];
105 } 105 }
106 """, 106 """,
107 ABOVE_ZERO, 107 ABOVE_ZERO,
108 108
109 """ 109 """
110 main(value) { 110 main(value) {
111 var a = new List(); 111 var a = new List();
112 return a[1]; 112 return a[1];
113 } 113 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Expect.isTrue(!generated.contains('||')); 236 Expect.isTrue(!generated.contains('||'));
237 Expect.isTrue(generated.contains('ioore')); 237 Expect.isTrue(generated.contains('ioore'));
238 break; 238 break;
239 239
240 case KEPT: 240 case KEPT:
241 Expect.isTrue(generated.contains('ioore')); 241 Expect.isTrue(generated.contains('ioore'));
242 break; 242 break;
243 243
244 case ONE_CHECK: 244 case ONE_CHECK:
245 RegExp regexp = new RegExp('ioore'); 245 RegExp regexp = new RegExp('ioore');
246 Iterator matches = regexp.allMatches(generated).iterator(); 246 Iterator matches = regexp.allMatches(generated).iterator;
247 checkNumberOfMatches(matches, 1); 247 checkNumberOfMatches(matches, 1);
248 break; 248 break;
249 249
250 case ONE_ZERO_CHECK: 250 case ONE_ZERO_CHECK:
251 RegExp regexp = new RegExp('< 0'); 251 RegExp regexp = new RegExp('< 0');
252 Iterator matches = regexp.allMatches(generated).iterator(); 252 Iterator matches = regexp.allMatches(generated).iterator;
253 checkNumberOfMatches(matches, 1); 253 checkNumberOfMatches(matches, 1);
254 break; 254 break;
255 } 255 }
256 } 256 }
257 257
258 258
259 main() { 259 main() {
260 for (int i = 0; i < TESTS.length; i += 2) { 260 for (int i = 0; i < TESTS.length; i += 2) {
261 expect(TESTS[i], TESTS[i + 1]); 261 expect(TESTS[i], TESTS[i + 1]);
262 } 262 }
263 } 263 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_guard_unuser_test.dart ('k') | tests/compiler/dart2js_extra/for_in_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698