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

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

Issue 12743005: Revert "Remove Expect from core library." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload (first upload failed). Created 7 years, 9 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 // Test optimized CodeUnitAt and array access. 5 // Test optimized CodeUnitAt and array access.
6 6
7 import "package:expect/expect.dart";
8
9
10 String one_byte = "hest"; 7 String one_byte = "hest";
11 String two_byte = "høns"; 8 String two_byte = "høns";
12 9
13 int testOneByteCodeUnitAt(String x, int j) { 10 int testOneByteCodeUnitAt(String x, int j) {
14 int test() { 11 int test() {
15 return x.codeUnitAt(j); 12 return x.codeUnitAt(j);
16 } 13 }
17 for (int i = 0; i < 10000; i++) test(); 14 for (int i = 0; i < 10000; i++) test();
18 return test(); 15 return test();
19 } 16 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 Expect.equals(248, testConstantStringCodeUnitAt(1)); 68 Expect.equals(248, testConstantStringCodeUnitAt(1));
72 Expect.equals(101, testConstantIndexCodeUnitAt(one_byte)); 69 Expect.equals(101, testConstantIndexCodeUnitAt(one_byte));
73 } 70 }
74 for (int j = 0; j < 2000; j++) { 71 for (int j = 0; j < 2000; j++) {
75 Expect.equals(436, testOneByteCodeUnitAtInLoop(one_byte)); 72 Expect.equals(436, testOneByteCodeUnitAtInLoop(one_byte));
76 Expect.equals(577, testTwoByteCodeUnitAtInLoop(two_byte)); 73 Expect.equals(577, testTwoByteCodeUnitAtInLoop(two_byte));
77 } 74 }
78 Expect.throws(() => testOneByteCodeUnitAtInLoop(123)); 75 Expect.throws(() => testOneByteCodeUnitAtInLoop(123));
79 Expect.throws(() => testTwoByteCodeUnitAtInLoop(123)); 76 Expect.throws(() => testTwoByteCodeUnitAtInLoop(123));
80 } 77 }
OLDNEW
« no previous file with comments | « tests/language/optimized_string_charat_test.dart ('k') | tests/language/optional_named_parameters_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698