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

Unified Diff: tests/standalone/byte_array_test.dart

Issue 11366071: Throwing type check errors is very slow compared to other checks (e.g., value check error in typed … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/byte_array_test.dart
===================================================================
--- tests/standalone/byte_array_test.dart (revision 14498)
+++ tests/standalone/byte_array_test.dart (working copy)
@@ -23,7 +23,7 @@
}
-void testUnsignedByteArrayRange() {
+void testUnsignedByteArrayRange(bool check_throws) {
Uint8List byteArray;
byteArray = new Uint8List(10);
@@ -32,16 +32,18 @@
byteArray[1] = 0;
Expect.equals(0, byteArray[1]);
- Expect.throws(() {
- byteArray[1] = 1.2;
- });
// These should eventually throw.
byteArray[1] = 256;
byteArray[1] = -1;
byteArray[2] = -129;
+ if (check_throws) {
+ Expect.throws(() {
+ byteArray[1] = 1.2;
+ });
+ }
}
-void testByteArrayRange() {
+void testByteArrayRange(bool check_throws) {
Int8List byteArray;
byteArray = new Int8List(10);
byteArray[1] = 0;
@@ -50,12 +52,14 @@
Expect.equals(-128, byteArray[2]);
byteArray[3] = 127;
Expect.equals(127, byteArray[3]);
- Expect.throws(() {
- byteArray[1] = 1.2;
- });
// This should eventually throw.
byteArray[0] = 128;
byteArray[4] = -129;
+ if (check_throws) {
+ Expect.throws(() {
+ byteArray[1] = 1.2;
+ });
+ }
}
void testSetRange() {
@@ -158,12 +162,14 @@
main() {
for (int i = 0; i < 2000; i++) {
testCreateByteArray();
- testByteArrayRange();
- testUnsignedByteArrayRange();
+ testByteArrayRange(false);
+ testUnsignedByteArrayRange(false);
testSetRange();
testIndexOutOfRange();
testIndexOf();
testSubArray();
}
+ testByteArrayRange(true);
+ testUnsignedByteArrayRange(true);
}
« 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