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

Side by Side Diff: tests/language/constant_propagation_phis_test.dart

Issue 12212016: Remove Expect from core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add deprecation comment for ExpectException and revert one test. Created 7 years, 8 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 | « tests/language/constant_fold_equals_test.dart ('k') | tests/language/constructor2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "package:expect/expect.dart";
6
5 // Test that constant propagation correctly updates phis when predecessor's 7 // Test that constant propagation correctly updates phis when predecessor's
6 // reachability changes. 8 // reachability changes.
7 9
8 final keys = const ["keyA"]; 10 final keys = const ["keyA"];
9 final values = const ["a"]; 11 final values = const ["a"];
10 12
11 main() { 13 main() {
12 for (var i = 0; i < 10000; i++) test(keys[0]); 14 for (var i = 0; i < 10000; i++) test(keys[0]);
13 } 15 }
14 16
15 test(key) { 17 test(key) {
16 var ref = key2value(key); 18 var ref = key2value(key);
17 Expect.equals("a", (ref == null) ? "-" : ref); 19 Expect.equals("a", (ref == null) ? "-" : ref);
18 } 20 }
19 21
20 key2value(key) { 22 key2value(key) {
21 var index = indexOf(keys, key); 23 var index = indexOf(keys, key);
22 return (index == -1) ? null : values[index]; 24 return (index == -1) ? null : values[index];
23 } 25 }
24 26
25 indexOf(keys, key) { 27 indexOf(keys, key) {
26 for (var i = keys.length - 1; i >= 0; i--) { 28 for (var i = keys.length - 1; i >= 0; i--) {
27 var equals = keys[i] == key; 29 var equals = keys[i] == key;
28 if (equals) return i; 30 if (equals) return i;
29 } 31 }
30 return -1; 32 return -1;
31 } 33 }
OLDNEW
« no previous file with comments | « tests/language/constant_fold_equals_test.dart ('k') | tests/language/constructor2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698