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

Unified Diff: tests/standalone/byte_array_test.dart

Issue 10386039: Add indexOf to Int/Float-List's. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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/lib/byte_array.dart ('K') | « runtime/lib/byte_array.dart ('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 2938576eb9345c41392b8845849be2515e5fdeec..2ca9c7eef6e06773ab8b6dcf475cc21f7b309935 100644
--- a/tests/standalone/byte_array_test.dart
+++ b/tests/standalone/byte_array_test.dart
@@ -53,10 +53,31 @@ void testIndexOutOfRange() {
});
}
+void testIndexOf() {
+ var list = new Uint8List(10);
+ for (int i = 0; i < list.length; i++) {
+ list[i] = i + 10;
+ }
+ Expect.equals(0, list.indexOf(10));
+ Expect.equals(5, list.indexOf(15));
+ Expect.equals(9, list.indexOf(19));
+ Expect.equals(-1, list.indexOf(20));
+
+ list = new Float32List(10);
+ for (int i = 0; i < list.length; i++) {
+ list[i] = i + 10.0;
+ }
+ Expect.equals(0, list.indexOf(10.0));
+ Expect.equals(5, list.indexOf(15.0));
+ Expect.equals(9, list.indexOf(19.0));
+ Expect.equals(-1, list.indexOf(20.0));
+}
+
main() {
for (int i = 0; i < 2000; i++) {
testCreateByteArray();
testSetRange();
testIndexOutOfRange();
+ testIndexOf();
}
}
« runtime/lib/byte_array.dart ('K') | « runtime/lib/byte_array.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698