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

Unified Diff: tests/standalone/byte_array_test.dart

Issue 11074016: Intrinsify writing to Uint8 and Int8 arrays on IA32. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments, fixed signed check, and tests. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/intrinsifier_ia32.cc ('K') | « runtime/vm/intrinsifier_x64.cc ('k') | 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
diff --git a/tests/standalone/byte_array_test.dart b/tests/standalone/byte_array_test.dart
index 2f60f29d18995376bba405495ea19845989a6886..388f933f2c5cdb7112dd074bb79b1d16294c0967 100644
--- a/tests/standalone/byte_array_test.dart
+++ b/tests/standalone/byte_array_test.dart
@@ -20,6 +20,36 @@ void testCreateByteArray() {
for (int i = 0; i < 10; i++) {
Expect.equals(0, byteArray[i]);
}
+
+}
+
+void testUnsignedByteArrayRange() {
+ Uint8List byteArray;
+ byteArray = new Uint8List(10);
+
+ byteArray[1] = 255;
+ Expect.equals(255, byteArray[1]);
+ byteArray[1] = 0;
+ Expect.equals(0, byteArray[1]);
+
+ // These should eventually throw.
srdjan 2012/10/16 17:56:01 Don't they throw? You can use Expect.throws(...) t
+ byteArray[1] = 256;
+ byteArray[1] = -1;
+ byteArray[2] = -129;
+}
+
+void testByteArrayRange() {
+ Int8List byteArray;
+ byteArray = new Int8List(10);
+ byteArray[1] = 0;
+ Expect.equals(0, byteArray[1]);
+ byteArray[2] = -128;
+ Expect.equals(-128, byteArray[2]);
+ byteArray[3] = 127;
+ Expect.equals(127, byteArray[3]);
+ // This should eventually throw.
srdjan 2012/10/16 17:56:01 ditto
+ byteArray[0] = 128;
+ byteArray[4] = -129;
}
void testSetRange() {
@@ -81,6 +111,8 @@ void testIndexOf() {
main() {
for (int i = 0; i < 2000; i++) {
testCreateByteArray();
+ testByteArrayRange();
+ testUnsignedByteArrayRange();
testSetRange();
testIndexOutOfRange();
testIndexOf();
« runtime/vm/intrinsifier_ia32.cc ('K') | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698