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

Side by Side 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: Removed var. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/byte_array.dart ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Dart test program for testing native byte arrays. 5 // Dart test program for testing native byte arrays.
6 6
7 void testCreateByteArray() { 7 void testCreateByteArray() {
8 Uint8List byteArray; 8 Uint8List byteArray;
9 9
10 byteArray = new Uint8List(0); 10 byteArray = new Uint8List(0);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 Expect.throws(() { 47 Expect.throws(() {
48 byteArray.setRange(0, 4, list); 48 byteArray.setRange(0, 4, list);
49 }); 49 });
50 50
51 Expect.throws(() { 51 Expect.throws(() {
52 byteArray.setRange(3, 1, list); 52 byteArray.setRange(3, 1, list);
53 }); 53 });
54 } 54 }
55 55
56 void testIndexOf() {
57 var list = new Uint8List(10);
58 for (int i = 0; i < list.length; i++) {
59 list[i] = i + 10;
60 }
61 Expect.equals(0, list.indexOf(10));
62 Expect.equals(5, list.indexOf(15));
63 Expect.equals(9, list.indexOf(19));
64 Expect.equals(-1, list.indexOf(20));
65
66 list = new Float32List(10);
67 for (int i = 0; i < list.length; i++) {
68 list[i] = i + 10.0;
69 }
70 Expect.equals(0, list.indexOf(10.0));
71 Expect.equals(5, list.indexOf(15.0));
72 Expect.equals(9, list.indexOf(19.0));
73 Expect.equals(-1, list.indexOf(20.0));
74 }
75
56 main() { 76 main() {
57 for (int i = 0; i < 2000; i++) { 77 for (int i = 0; i < 2000; i++) {
58 testCreateByteArray(); 78 testCreateByteArray();
59 testSetRange(); 79 testSetRange();
60 testIndexOutOfRange(); 80 testIndexOutOfRange();
81 testIndexOf();
61 } 82 }
62 } 83 }
OLDNEW
« no previous file with comments | « runtime/lib/byte_array.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698