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

Side by Side Diff: runtime/tests/vm/dart/byte_array_test.dart

Issue 11275042: Renaming IndexOutOfRangeException to RangeError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Regenerated html files. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/string_base.dart ('k') | runtime/vm/exceptions.h » ('j') | 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) 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 // Library tag to be able to run in html test framework. 5 // Library tag to be able to run in html test framework.
6 #library("ByteArrayTest.dart"); 6 #library("ByteArrayTest.dart");
7 7
8 #import('dart:scalarlist'); 8 #import('dart:scalarlist');
9 9
10 class ByteArrayTest { 10 class ByteArrayTest {
11 static testInt8List() { 11 static testInt8List() {
12 Expect.throws(() { new Int8List(-1); }, 12 Expect.throws(() { new Int8List(-1); },
13 (e) { return e is ArgumentError; }); 13 (e) { return e is ArgumentError; });
14 var array = new Int8List(10); 14 var array = new Int8List(10);
15 Expect.isTrue(array is List<int>); 15 Expect.isTrue(array is List<int>);
16 Expect.equals(10, array.length); 16 Expect.equals(10, array.length);
17 Expect.equals(1, array.bytesPerElement()); 17 Expect.equals(1, array.bytesPerElement());
18 Expect.equals(10, array.lengthInBytes()); 18 Expect.equals(10, array.lengthInBytes());
19 Expect.listEquals([0, 0, 0, 0, 0, 19 Expect.listEquals([0, 0, 0, 0, 0,
20 0, 0, 0, 0, 0], 20 0, 0, 0, 0, 0],
21 array); 21 array);
22 Expect.throws(() { array[-1] = 0; }, 22 Expect.throws(() { array[-1] = 0; },
23 (e) { return e is IndexOutOfRangeException; }); 23 (e) { return e is RangeError; });
24 Expect.throws(() { return array[-1]; }, 24 Expect.throws(() { return array[-1]; },
25 (e) { return e is IndexOutOfRangeException; }); 25 (e) { return e is RangeError; });
26 Expect.throws(() { array[10]; }, 26 Expect.throws(() { array[10]; },
27 (e) { return e is IndexOutOfRangeException; }); 27 (e) { return e is RangeError; });
28 Expect.throws(() { array[10] = 0; }, 28 Expect.throws(() { array[10] = 0; },
29 (e) { return e is IndexOutOfRangeException; }); 29 (e) { return e is RangeError; });
30 Expect.throws(() { array.add(0); }, 30 Expect.throws(() { array.add(0); },
31 (e) { return e is UnsupportedError; }); 31 (e) { return e is UnsupportedError; });
32 Expect.throws(() { array.addAll([0]); }, 32 Expect.throws(() { array.addAll([0]); },
33 (e) { return e is UnsupportedError; }); 33 (e) { return e is UnsupportedError; });
34 Expect.throws(() { array.addLast(0); }, 34 Expect.throws(() { array.addLast(0); },
35 (e) { return e is UnsupportedError; }); 35 (e) { return e is UnsupportedError; });
36 Expect.throws(() { array.clear(); }, 36 Expect.throws(() { array.clear(); },
37 (e) { return e is UnsupportedError; }); 37 (e) { return e is UnsupportedError; });
38 Expect.throws(() { array.insertRange(0, array.length, 0); }, 38 Expect.throws(() { array.insertRange(0, array.length, 0); },
39 (e) { return e is UnsupportedError; }); 39 (e) { return e is UnsupportedError; });
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 (e) { return e is ArgumentError; }); 97 (e) { return e is ArgumentError; });
98 var array = new Uint8List(10); 98 var array = new Uint8List(10);
99 Expect.isTrue(array is List<int>); 99 Expect.isTrue(array is List<int>);
100 Expect.equals(10, array.length); 100 Expect.equals(10, array.length);
101 Expect.equals(1, array.bytesPerElement()); 101 Expect.equals(1, array.bytesPerElement());
102 Expect.equals(10, array.lengthInBytes()); 102 Expect.equals(10, array.lengthInBytes());
103 Expect.listEquals([0, 0, 0, 0, 0, 103 Expect.listEquals([0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0], 104 0, 0, 0, 0, 0],
105 array); 105 array);
106 Expect.throws(() { array[-1] = 0; }, 106 Expect.throws(() { array[-1] = 0; },
107 (e) { return e is IndexOutOfRangeException; }); 107 (e) { return e is RangeError; });
108 Expect.throws(() { return array[-1]; }, 108 Expect.throws(() { return array[-1]; },
109 (e) { return e is IndexOutOfRangeException; }); 109 (e) { return e is RangeError; });
110 Expect.throws(() { array[10]; }, 110 Expect.throws(() { array[10]; },
111 (e) { return e is IndexOutOfRangeException; }); 111 (e) { return e is RangeError; });
112 Expect.throws(() { array[10] = 0; }, 112 Expect.throws(() { array[10] = 0; },
113 (e) { return e is IndexOutOfRangeException; }); 113 (e) { return e is RangeError; });
114 Expect.throws(() { array.add(0); }, 114 Expect.throws(() { array.add(0); },
115 (e) { return e is UnsupportedError; }); 115 (e) { return e is UnsupportedError; });
116 Expect.throws(() { array.addAll([0]); }, 116 Expect.throws(() { array.addAll([0]); },
117 (e) { return e is UnsupportedError; }); 117 (e) { return e is UnsupportedError; });
118 Expect.throws(() { array.addLast(0); }, 118 Expect.throws(() { array.addLast(0); },
119 (e) { return e is UnsupportedError; }); 119 (e) { return e is UnsupportedError; });
120 Expect.throws(() { array.clear(); }, 120 Expect.throws(() { array.clear(); },
121 (e) { return e is UnsupportedError; }); 121 (e) { return e is UnsupportedError; });
122 Expect.throws(() { array.insertRange(0, array.length, 0); }, 122 Expect.throws(() { array.insertRange(0, array.length, 0); },
123 (e) { return e is UnsupportedError; }); 123 (e) { return e is UnsupportedError; });
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 (e) { return e is ArgumentError; }); 169 (e) { return e is ArgumentError; });
170 var array = new Int16List(10); 170 var array = new Int16List(10);
171 Expect.isTrue(array is List<int>); 171 Expect.isTrue(array is List<int>);
172 Expect.equals(10, array.length); 172 Expect.equals(10, array.length);
173 Expect.equals(2, array.bytesPerElement()); 173 Expect.equals(2, array.bytesPerElement());
174 Expect.equals(20, array.lengthInBytes()); 174 Expect.equals(20, array.lengthInBytes());
175 Expect.listEquals([0, 0, 0, 0, 0, 175 Expect.listEquals([0, 0, 0, 0, 0,
176 0, 0, 0, 0, 0], 176 0, 0, 0, 0, 0],
177 array); 177 array);
178 Expect.throws(() { array[-1] = 0; }, 178 Expect.throws(() { array[-1] = 0; },
179 (e) { return e is IndexOutOfRangeException; }); 179 (e) { return e is RangeError; });
180 Expect.throws(() { return array[-1]; }, 180 Expect.throws(() { return array[-1]; },
181 (e) { return e is IndexOutOfRangeException; }); 181 (e) { return e is RangeError; });
182 Expect.throws(() { array[10]; }, 182 Expect.throws(() { array[10]; },
183 (e) { return e is IndexOutOfRangeException; }); 183 (e) { return e is RangeError; });
184 Expect.throws(() { array[10] = 0; }, 184 Expect.throws(() { array[10] = 0; },
185 (e) { return e is IndexOutOfRangeException; }); 185 (e) { return e is RangeError; });
186 Expect.throws(() { array.add(0); }, 186 Expect.throws(() { array.add(0); },
187 (e) { return e is UnsupportedError; }); 187 (e) { return e is UnsupportedError; });
188 Expect.throws(() { array.addAll([0]); }, 188 Expect.throws(() { array.addAll([0]); },
189 (e) { return e is UnsupportedError; }); 189 (e) { return e is UnsupportedError; });
190 Expect.throws(() { array.addLast(0); }, 190 Expect.throws(() { array.addLast(0); },
191 (e) { return e is UnsupportedError; }); 191 (e) { return e is UnsupportedError; });
192 Expect.throws(() { array.clear(); }, 192 Expect.throws(() { array.clear(); },
193 (e) { return e is UnsupportedError; }); 193 (e) { return e is UnsupportedError; });
194 Expect.throws(() { array.insertRange(0, array.length, 0); }, 194 Expect.throws(() { array.insertRange(0, array.length, 0); },
195 (e) { return e is UnsupportedError; }); 195 (e) { return e is UnsupportedError; });
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 (e) { return e is ArgumentError; }); 253 (e) { return e is ArgumentError; });
254 var array = new Uint16List(10); 254 var array = new Uint16List(10);
255 Expect.isTrue(array is List<int>); 255 Expect.isTrue(array is List<int>);
256 Expect.equals(10, array.length); 256 Expect.equals(10, array.length);
257 Expect.equals(2, array.bytesPerElement()); 257 Expect.equals(2, array.bytesPerElement());
258 Expect.equals(20, array.lengthInBytes()); 258 Expect.equals(20, array.lengthInBytes());
259 Expect.listEquals([0, 0, 0, 0, 0, 259 Expect.listEquals([0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0], 260 0, 0, 0, 0, 0],
261 array); 261 array);
262 Expect.throws(() { array[-1] = 0; }, 262 Expect.throws(() { array[-1] = 0; },
263 (e) { return e is IndexOutOfRangeException; }); 263 (e) { return e is RangeError; });
264 Expect.throws(() { return array[-1]; }, 264 Expect.throws(() { return array[-1]; },
265 (e) { return e is IndexOutOfRangeException; }); 265 (e) { return e is RangeError; });
266 Expect.throws(() { array[10]; }, 266 Expect.throws(() { array[10]; },
267 (e) { return e is IndexOutOfRangeException; }); 267 (e) { return e is RangeError; });
268 Expect.throws(() { array[10] = 0; }, 268 Expect.throws(() { array[10] = 0; },
269 (e) { return e is IndexOutOfRangeException; }); 269 (e) { return e is RangeError; });
270 Expect.throws(() { array.add(0); }, 270 Expect.throws(() { array.add(0); },
271 (e) { return e is UnsupportedError; }); 271 (e) { return e is UnsupportedError; });
272 Expect.throws(() { array.addAll([0]); }, 272 Expect.throws(() { array.addAll([0]); },
273 (e) { return e is UnsupportedError; }); 273 (e) { return e is UnsupportedError; });
274 Expect.throws(() { array.addLast(0); }, 274 Expect.throws(() { array.addLast(0); },
275 (e) { return e is UnsupportedError; }); 275 (e) { return e is UnsupportedError; });
276 Expect.throws(() { array.clear(); }, 276 Expect.throws(() { array.clear(); },
277 (e) { return e is UnsupportedError; }); 277 (e) { return e is UnsupportedError; });
278 Expect.throws(() { array.insertRange(0, array.length, 0); }, 278 Expect.throws(() { array.insertRange(0, array.length, 0); },
279 (e) { return e is UnsupportedError; }); 279 (e) { return e is UnsupportedError; });
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 (e) { return e is ArgumentError; }); 325 (e) { return e is ArgumentError; });
326 var array = new Int32List(10); 326 var array = new Int32List(10);
327 Expect.isTrue(array is List<int>); 327 Expect.isTrue(array is List<int>);
328 Expect.equals(10, array.length); 328 Expect.equals(10, array.length);
329 Expect.equals(4, array.bytesPerElement()); 329 Expect.equals(4, array.bytesPerElement());
330 Expect.equals(40, array.lengthInBytes()); 330 Expect.equals(40, array.lengthInBytes());
331 Expect.listEquals([0, 0, 0, 0, 0, 331 Expect.listEquals([0, 0, 0, 0, 0,
332 0, 0, 0, 0, 0], 332 0, 0, 0, 0, 0],
333 array); 333 array);
334 Expect.throws(() { array[-1] = 0; }, 334 Expect.throws(() { array[-1] = 0; },
335 (e) { return e is IndexOutOfRangeException; }); 335 (e) { return e is RangeError; });
336 Expect.throws(() { return array[-1]; }, 336 Expect.throws(() { return array[-1]; },
337 (e) { return e is IndexOutOfRangeException; }); 337 (e) { return e is RangeError; });
338 Expect.throws(() { array[10]; }, 338 Expect.throws(() { array[10]; },
339 (e) { return e is IndexOutOfRangeException; }); 339 (e) { return e is RangeError; });
340 Expect.throws(() { array[10] = 0; }, 340 Expect.throws(() { array[10] = 0; },
341 (e) { return e is IndexOutOfRangeException; }); 341 (e) { return e is RangeError; });
342 Expect.throws(() { array.add(0); }, 342 Expect.throws(() { array.add(0); },
343 (e) { return e is UnsupportedError; }); 343 (e) { return e is UnsupportedError; });
344 Expect.throws(() { array.addAll([0]); }, 344 Expect.throws(() { array.addAll([0]); },
345 (e) { return e is UnsupportedError; }); 345 (e) { return e is UnsupportedError; });
346 Expect.throws(() { array.addLast(0); }, 346 Expect.throws(() { array.addLast(0); },
347 (e) { return e is UnsupportedError; }); 347 (e) { return e is UnsupportedError; });
348 Expect.throws(() { array.clear(); }, 348 Expect.throws(() { array.clear(); },
349 (e) { return e is UnsupportedError; }); 349 (e) { return e is UnsupportedError; });
350 Expect.throws(() { array.insertRange(0, array.length, 0); }, 350 Expect.throws(() { array.insertRange(0, array.length, 0); },
351 (e) { return e is UnsupportedError; }); 351 (e) { return e is UnsupportedError; });
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 (e) { return e is ArgumentError; }); 415 (e) { return e is ArgumentError; });
416 var array = new Uint32List(10); 416 var array = new Uint32List(10);
417 Expect.isTrue(array is List<int>); 417 Expect.isTrue(array is List<int>);
418 Expect.equals(10, array.length); 418 Expect.equals(10, array.length);
419 Expect.equals(4, array.bytesPerElement()); 419 Expect.equals(4, array.bytesPerElement());
420 Expect.equals(40, array.lengthInBytes()); 420 Expect.equals(40, array.lengthInBytes());
421 Expect.listEquals([0, 0, 0, 0, 0, 421 Expect.listEquals([0, 0, 0, 0, 0,
422 0, 0, 0, 0, 0], 422 0, 0, 0, 0, 0],
423 array); 423 array);
424 Expect.throws(() { array[-1] = 0; }, 424 Expect.throws(() { array[-1] = 0; },
425 (e) { return e is IndexOutOfRangeException; }); 425 (e) { return e is RangeError; });
426 Expect.throws(() { return array[-1]; }, 426 Expect.throws(() { return array[-1]; },
427 (e) { return e is IndexOutOfRangeException; }); 427 (e) { return e is RangeError; });
428 Expect.throws(() { array[10]; }, 428 Expect.throws(() { array[10]; },
429 (e) { return e is IndexOutOfRangeException; }); 429 (e) { return e is RangeError; });
430 Expect.throws(() { array[10] = 0; }, 430 Expect.throws(() { array[10] = 0; },
431 (e) { return e is IndexOutOfRangeException; }); 431 (e) { return e is RangeError; });
432 Expect.throws(() { array.add(0); }, 432 Expect.throws(() { array.add(0); },
433 (e) { return e is UnsupportedError; }); 433 (e) { return e is UnsupportedError; });
434 Expect.throws(() { array.addAll([0]); }, 434 Expect.throws(() { array.addAll([0]); },
435 (e) { return e is UnsupportedError; }); 435 (e) { return e is UnsupportedError; });
436 Expect.throws(() { array.addLast(0); }, 436 Expect.throws(() { array.addLast(0); },
437 (e) { return e is UnsupportedError; }); 437 (e) { return e is UnsupportedError; });
438 Expect.throws(() { array.clear(); }, 438 Expect.throws(() { array.clear(); },
439 (e) { return e is UnsupportedError; }); 439 (e) { return e is UnsupportedError; });
440 Expect.throws(() { array.insertRange(0, array.length, 0); }, 440 Expect.throws(() { array.insertRange(0, array.length, 0); },
441 (e) { return e is UnsupportedError; }); 441 (e) { return e is UnsupportedError; });
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 (e) { return e is ArgumentError; }); 490 (e) { return e is ArgumentError; });
491 var array = new Int64List(10); 491 var array = new Int64List(10);
492 Expect.isTrue(array is List<int>); 492 Expect.isTrue(array is List<int>);
493 Expect.equals(10, array.length); 493 Expect.equals(10, array.length);
494 Expect.equals(8, array.bytesPerElement()); 494 Expect.equals(8, array.bytesPerElement());
495 Expect.equals(80, array.lengthInBytes()); 495 Expect.equals(80, array.lengthInBytes());
496 Expect.listEquals([0, 0, 0, 0, 0, 496 Expect.listEquals([0, 0, 0, 0, 0,
497 0, 0, 0, 0, 0], 497 0, 0, 0, 0, 0],
498 array); 498 array);
499 Expect.throws(() { array[-1] = 0; }, 499 Expect.throws(() { array[-1] = 0; },
500 (e) { return e is IndexOutOfRangeException; }); 500 (e) { return e is RangeError; });
501 Expect.throws(() { return array[-1]; }, 501 Expect.throws(() { return array[-1]; },
502 (e) { return e is IndexOutOfRangeException; }); 502 (e) { return e is RangeError; });
503 Expect.throws(() { array[10]; }, 503 Expect.throws(() { array[10]; },
504 (e) { return e is IndexOutOfRangeException; }); 504 (e) { return e is RangeError; });
505 Expect.throws(() { array[10] = 0; }, 505 Expect.throws(() { array[10] = 0; },
506 (e) { return e is IndexOutOfRangeException; }); 506 (e) { return e is RangeError; });
507 Expect.throws(() { array.add(0); }, 507 Expect.throws(() { array.add(0); },
508 (e) { return e is UnsupportedError; }); 508 (e) { return e is UnsupportedError; });
509 Expect.throws(() { array.addAll([0]); }, 509 Expect.throws(() { array.addAll([0]); },
510 (e) { return e is UnsupportedError; }); 510 (e) { return e is UnsupportedError; });
511 Expect.throws(() { array.addLast(0); }, 511 Expect.throws(() { array.addLast(0); },
512 (e) { return e is UnsupportedError; }); 512 (e) { return e is UnsupportedError; });
513 Expect.throws(() { array.clear(); }, 513 Expect.throws(() { array.clear(); },
514 (e) { return e is UnsupportedError; }); 514 (e) { return e is UnsupportedError; });
515 Expect.throws(() { array.insertRange(0, array.length, 0); }, 515 Expect.throws(() { array.insertRange(0, array.length, 0); },
516 (e) { return e is UnsupportedError; }); 516 (e) { return e is UnsupportedError; });
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 (e) { return e is ArgumentError; }); 581 (e) { return e is ArgumentError; });
582 var array = new Uint64List(10); 582 var array = new Uint64List(10);
583 Expect.isTrue(array is List<int>); 583 Expect.isTrue(array is List<int>);
584 Expect.equals(10, array.length); 584 Expect.equals(10, array.length);
585 Expect.equals(8, array.bytesPerElement()); 585 Expect.equals(8, array.bytesPerElement());
586 Expect.equals(80, array.lengthInBytes()); 586 Expect.equals(80, array.lengthInBytes());
587 Expect.listEquals([0, 0, 0, 0, 0, 587 Expect.listEquals([0, 0, 0, 0, 0,
588 0, 0, 0, 0, 0], 588 0, 0, 0, 0, 0],
589 array); 589 array);
590 Expect.throws(() { array[-1] = 0; }, 590 Expect.throws(() { array[-1] = 0; },
591 (e) { return e is IndexOutOfRangeException; }); 591 (e) { return e is RangeError; });
592 Expect.throws(() { return array[-1]; }, 592 Expect.throws(() { return array[-1]; },
593 (e) { return e is IndexOutOfRangeException; }); 593 (e) { return e is RangeError; });
594 Expect.throws(() { array[10]; }, 594 Expect.throws(() { array[10]; },
595 (e) { return e is IndexOutOfRangeException; }); 595 (e) { return e is RangeError; });
596 Expect.throws(() { array[10] = 0; }, 596 Expect.throws(() { array[10] = 0; },
597 (e) { return e is IndexOutOfRangeException; }); 597 (e) { return e is RangeError; });
598 Expect.throws(() { array.add(0); }, 598 Expect.throws(() { array.add(0); },
599 (e) { return e is UnsupportedError; }); 599 (e) { return e is UnsupportedError; });
600 Expect.throws(() { array.addAll([0]); }, 600 Expect.throws(() { array.addAll([0]); },
601 (e) { return e is UnsupportedError; }); 601 (e) { return e is UnsupportedError; });
602 Expect.throws(() { array.addLast(0); }, 602 Expect.throws(() { array.addLast(0); },
603 (e) { return e is UnsupportedError; }); 603 (e) { return e is UnsupportedError; });
604 Expect.throws(() { array.clear(); }, 604 Expect.throws(() { array.clear(); },
605 (e) { return e is UnsupportedError; }); 605 (e) { return e is UnsupportedError; });
606 Expect.throws(() { array.insertRange(0, array.length, 0); }, 606 Expect.throws(() { array.insertRange(0, array.length, 0); },
607 (e) { return e is UnsupportedError; }); 607 (e) { return e is UnsupportedError; });
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 (e) { return e is ArgumentError; }); 656 (e) { return e is ArgumentError; });
657 var array = new Float32List(10); 657 var array = new Float32List(10);
658 Expect.isTrue(array is List<double>); 658 Expect.isTrue(array is List<double>);
659 Expect.equals(10, array.length); 659 Expect.equals(10, array.length);
660 Expect.equals(4, array.bytesPerElement()); 660 Expect.equals(4, array.bytesPerElement());
661 Expect.equals(40, array.lengthInBytes()); 661 Expect.equals(40, array.lengthInBytes());
662 Expect.listEquals([0.0, 0.0, 0.0, 0.0, 0.0, 662 Expect.listEquals([0.0, 0.0, 0.0, 0.0, 0.0,
663 0.0, 0.0, 0.0, 0.0, 0.0], 663 0.0, 0.0, 0.0, 0.0, 0.0],
664 array); 664 array);
665 Expect.throws(() { array[-1] = 0.0; }, 665 Expect.throws(() { array[-1] = 0.0; },
666 (e) { return e is IndexOutOfRangeException; }); 666 (e) { return e is RangeError; });
667 Expect.throws(() { return array[-1]; }, 667 Expect.throws(() { return array[-1]; },
668 (e) { return e is IndexOutOfRangeException; }); 668 (e) { return e is RangeError; });
669 Expect.throws(() { array[10]; }, 669 Expect.throws(() { array[10]; },
670 (e) { return e is IndexOutOfRangeException; }); 670 (e) { return e is RangeError; });
671 Expect.throws(() { array[10] = 0.0; }, 671 Expect.throws(() { array[10] = 0.0; },
672 (e) { return e is IndexOutOfRangeException; }); 672 (e) { return e is RangeError; });
673 Expect.throws(() { array.add(0.0); }, 673 Expect.throws(() { array.add(0.0); },
674 (e) { return e is UnsupportedError; }); 674 (e) { return e is UnsupportedError; });
675 Expect.throws(() { array.addAll([0]); }, 675 Expect.throws(() { array.addAll([0]); },
676 (e) { return e is UnsupportedError; }); 676 (e) { return e is UnsupportedError; });
677 Expect.throws(() { array.addLast(0.0); }, 677 Expect.throws(() { array.addLast(0.0); },
678 (e) { return e is UnsupportedError; }); 678 (e) { return e is UnsupportedError; });
679 Expect.throws(() { array.clear(); }, 679 Expect.throws(() { array.clear(); },
680 (e) { return e is UnsupportedError; }); 680 (e) { return e is UnsupportedError; });
681 Expect.throws(() { array.insertRange(0, array.length, 0.0); }, 681 Expect.throws(() { array.insertRange(0, array.length, 0.0); },
682 (e) { return e is UnsupportedError; }); 682 (e) { return e is UnsupportedError; });
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 (e) { return e is ArgumentError; }); 718 (e) { return e is ArgumentError; });
719 var array = new Float64List(10); 719 var array = new Float64List(10);
720 Expect.isTrue(array is List<double>); 720 Expect.isTrue(array is List<double>);
721 Expect.equals(10, array.length); 721 Expect.equals(10, array.length);
722 Expect.equals(8, array.bytesPerElement()); 722 Expect.equals(8, array.bytesPerElement());
723 Expect.equals(80, array.lengthInBytes()); 723 Expect.equals(80, array.lengthInBytes());
724 Expect.listEquals([0.0, 0.0, 0.0, 0.0, 0.0, 724 Expect.listEquals([0.0, 0.0, 0.0, 0.0, 0.0,
725 0.0, 0.0, 0.0, 0.0, 0.0], 725 0.0, 0.0, 0.0, 0.0, 0.0],
726 array); 726 array);
727 Expect.throws(() { array[-1] = 0.0; }, 727 Expect.throws(() { array[-1] = 0.0; },
728 (e) { return e is IndexOutOfRangeException; }); 728 (e) { return e is RangeError; });
729 Expect.throws(() { return array[-1]; }, 729 Expect.throws(() { return array[-1]; },
730 (e) { return e is IndexOutOfRangeException; }); 730 (e) { return e is RangeError; });
731 Expect.throws(() { array[10]; }, 731 Expect.throws(() { array[10]; },
732 (e) { return e is IndexOutOfRangeException; }); 732 (e) { return e is RangeError; });
733 Expect.throws(() { array[10] = 0.0; }, 733 Expect.throws(() { array[10] = 0.0; },
734 (e) { return e is IndexOutOfRangeException; }); 734 (e) { return e is RangeError; });
735 Expect.throws(() { array.add(0.0); }, 735 Expect.throws(() { array.add(0.0); },
736 (e) { return e is UnsupportedError; }); 736 (e) { return e is UnsupportedError; });
737 Expect.throws(() { array.addAll([0]); }, 737 Expect.throws(() { array.addAll([0]); },
738 (e) { return e is UnsupportedError; }); 738 (e) { return e is UnsupportedError; });
739 Expect.throws(() { array.addLast(0.0); }, 739 Expect.throws(() { array.addLast(0.0); },
740 (e) { return e is UnsupportedError; }); 740 (e) { return e is UnsupportedError; });
741 Expect.throws(() { array.clear(); }, 741 Expect.throws(() { array.clear(); },
742 (e) { return e is UnsupportedError; }); 742 (e) { return e is UnsupportedError; });
743 Expect.throws(() { array.insertRange(0, array.length, 0.0); }, 743 Expect.throws(() { array.insertRange(0, array.length, 0.0); },
744 (e) { return e is UnsupportedError; }); 744 (e) { return e is UnsupportedError; });
(...skipping 30 matching lines...) Expand all
775 array); 775 array);
776 } 776 }
777 777
778 static testByteList() { 778 static testByteList() {
779 var array = new Uint8List(8); 779 var array = new Uint8List(8);
780 Expect.equals(8, array.length); 780 Expect.equals(8, array.length);
781 Expect.equals(8, array.lengthInBytes()); 781 Expect.equals(8, array.lengthInBytes());
782 var byte_array = array.asByteArray(0, array.lengthInBytes()); 782 var byte_array = array.asByteArray(0, array.lengthInBytes());
783 Expect.equals(8, byte_array.lengthInBytes()); 783 Expect.equals(8, byte_array.lengthInBytes());
784 Expect.throws(() { byte_array.getInt8(-1); }, 784 Expect.throws(() { byte_array.getInt8(-1); },
785 (e) { return e is IndexOutOfRangeException; }); 785 (e) { return e is RangeError; });
786 Expect.throws(() { byte_array.getUint8(-1); }, 786 Expect.throws(() { byte_array.getUint8(-1); },
787 (e) { return e is IndexOutOfRangeException; }); 787 (e) { return e is RangeError; });
788 Expect.throws(() { byte_array.getInt16(-1); }, 788 Expect.throws(() { byte_array.getInt16(-1); },
789 (e) { return e is IndexOutOfRangeException; }); 789 (e) { return e is RangeError; });
790 Expect.throws(() { byte_array.getUint16(-1); }, 790 Expect.throws(() { byte_array.getUint16(-1); },
791 (e) { return e is IndexOutOfRangeException; }); 791 (e) { return e is RangeError; });
792 Expect.throws(() { byte_array.getInt32(-1); }, 792 Expect.throws(() { byte_array.getInt32(-1); },
793 (e) { return e is IndexOutOfRangeException; }); 793 (e) { return e is RangeError; });
794 Expect.throws(() { byte_array.getUint32(-1); }, 794 Expect.throws(() { byte_array.getUint32(-1); },
795 (e) { return e is IndexOutOfRangeException; }); 795 (e) { return e is RangeError; });
796 Expect.throws(() { byte_array.getInt64(-1); }, 796 Expect.throws(() { byte_array.getInt64(-1); },
797 (e) { return e is IndexOutOfRangeException; }); 797 (e) { return e is RangeError; });
798 Expect.throws(() { byte_array.getUint64(-1); }, 798 Expect.throws(() { byte_array.getUint64(-1); },
799 (e) { return e is IndexOutOfRangeException; }); 799 (e) { return e is RangeError; });
800 Expect.throws(() { byte_array.getFloat32(-1); }, 800 Expect.throws(() { byte_array.getFloat32(-1); },
801 (e) { return e is IndexOutOfRangeException; }); 801 (e) { return e is RangeError; });
802 Expect.throws(() { byte_array.getFloat64(-1); }, 802 Expect.throws(() { byte_array.getFloat64(-1); },
803 (e) { return e is IndexOutOfRangeException; }); 803 (e) { return e is RangeError; });
804 Expect.throws(() { byte_array.setInt8(-1, 0); }, 804 Expect.throws(() { byte_array.setInt8(-1, 0); },
805 (e) { return e is IndexOutOfRangeException; }); 805 (e) { return e is RangeError; });
806 Expect.throws(() { byte_array.setUint8(-1, 0); }, 806 Expect.throws(() { byte_array.setUint8(-1, 0); },
807 (e) { return e is IndexOutOfRangeException; }); 807 (e) { return e is RangeError; });
808 Expect.throws(() { byte_array.setInt16(-1, 0); }, 808 Expect.throws(() { byte_array.setInt16(-1, 0); },
809 (e) { return e is IndexOutOfRangeException; }); 809 (e) { return e is RangeError; });
810 Expect.throws(() { byte_array.setUint16(-1, 0); }, 810 Expect.throws(() { byte_array.setUint16(-1, 0); },
811 (e) { return e is IndexOutOfRangeException; }); 811 (e) { return e is RangeError; });
812 Expect.throws(() { byte_array.setInt32(-1, 0); }, 812 Expect.throws(() { byte_array.setInt32(-1, 0); },
813 (e) { return e is IndexOutOfRangeException; }); 813 (e) { return e is RangeError; });
814 Expect.throws(() { byte_array.setUint32(-1, 0); }, 814 Expect.throws(() { byte_array.setUint32(-1, 0); },
815 (e) { return e is IndexOutOfRangeException; }); 815 (e) { return e is RangeError; });
816 Expect.throws(() { byte_array.setInt64(-1, 0); }, 816 Expect.throws(() { byte_array.setInt64(-1, 0); },
817 (e) { return e is IndexOutOfRangeException; }); 817 (e) { return e is RangeError; });
818 Expect.throws(() { byte_array.setUint64(-1, 0); }, 818 Expect.throws(() { byte_array.setUint64(-1, 0); },
819 (e) { return e is IndexOutOfRangeException; }); 819 (e) { return e is RangeError; });
820 Expect.throws(() { byte_array.setFloat32(-1, 0.0); }, 820 Expect.throws(() { byte_array.setFloat32(-1, 0.0); },
821 (e) { return e is IndexOutOfRangeException; }); 821 (e) { return e is RangeError; });
822 Expect.throws(() { byte_array.setFloat64(-1, 0.0); }, 822 Expect.throws(() { byte_array.setFloat64(-1, 0.0); },
823 (e) { return e is IndexOutOfRangeException; }); 823 (e) { return e is RangeError; });
824 Expect.throws(() { byte_array.getInt8(8); }, 824 Expect.throws(() { byte_array.getInt8(8); },
825 (e) { return e is IndexOutOfRangeException; }); 825 (e) { return e is RangeError; });
826 Expect.throws(() { byte_array.getUint8(8); }, 826 Expect.throws(() { byte_array.getUint8(8); },
827 (e) { return e is IndexOutOfRangeException; }); 827 (e) { return e is RangeError; });
828 Expect.throws(() { byte_array.getInt16(8); }, 828 Expect.throws(() { byte_array.getInt16(8); },
829 (e) { return e is IndexOutOfRangeException; }); 829 (e) { return e is RangeError; });
830 Expect.throws(() { byte_array.getUint16(8); }, 830 Expect.throws(() { byte_array.getUint16(8); },
831 (e) { return e is IndexOutOfRangeException; }); 831 (e) { return e is RangeError; });
832 Expect.throws(() { byte_array.getInt32(8); }, 832 Expect.throws(() { byte_array.getInt32(8); },
833 (e) { return e is IndexOutOfRangeException; }); 833 (e) { return e is RangeError; });
834 Expect.throws(() { byte_array.getUint32(8); }, 834 Expect.throws(() { byte_array.getUint32(8); },
835 (e) { return e is IndexOutOfRangeException; }); 835 (e) { return e is RangeError; });
836 Expect.throws(() { byte_array.getInt64(8); }, 836 Expect.throws(() { byte_array.getInt64(8); },
837 (e) { return e is IndexOutOfRangeException; }); 837 (e) { return e is RangeError; });
838 Expect.throws(() { byte_array.getUint64(8); }, 838 Expect.throws(() { byte_array.getUint64(8); },
839 (e) { return e is IndexOutOfRangeException; }); 839 (e) { return e is RangeError; });
840 Expect.throws(() { byte_array.getFloat32(8); }, 840 Expect.throws(() { byte_array.getFloat32(8); },
841 (e) { return e is IndexOutOfRangeException; }); 841 (e) { return e is RangeError; });
842 Expect.throws(() { byte_array.getFloat64(8); }, 842 Expect.throws(() { byte_array.getFloat64(8); },
843 (e) { return e is IndexOutOfRangeException; }); 843 (e) { return e is RangeError; });
844 Expect.throws(() { byte_array.setInt8(8, 0); }, 844 Expect.throws(() { byte_array.setInt8(8, 0); },
845 (e) { return e is IndexOutOfRangeException; }); 845 (e) { return e is RangeError; });
846 Expect.throws(() { byte_array.setUint8(8, 0); }, 846 Expect.throws(() { byte_array.setUint8(8, 0); },
847 (e) { return e is IndexOutOfRangeException; }); 847 (e) { return e is RangeError; });
848 Expect.throws(() { byte_array.setInt16(8, 0); }, 848 Expect.throws(() { byte_array.setInt16(8, 0); },
849 (e) { return e is IndexOutOfRangeException; }); 849 (e) { return e is RangeError; });
850 Expect.throws(() { byte_array.setUint16(8, 0); }, 850 Expect.throws(() { byte_array.setUint16(8, 0); },
851 (e) { return e is IndexOutOfRangeException; }); 851 (e) { return e is RangeError; });
852 Expect.throws(() { byte_array.setInt32(8, 0); }, 852 Expect.throws(() { byte_array.setInt32(8, 0); },
853 (e) { return e is IndexOutOfRangeException; }); 853 (e) { return e is RangeError; });
854 Expect.throws(() { byte_array.setUint32(8, 0); }, 854 Expect.throws(() { byte_array.setUint32(8, 0); },
855 (e) { return e is IndexOutOfRangeException; }); 855 (e) { return e is RangeError; });
856 Expect.throws(() { byte_array.setInt64(8, 0); }, 856 Expect.throws(() { byte_array.setInt64(8, 0); },
857 (e) { return e is IndexOutOfRangeException; }); 857 (e) { return e is RangeError; });
858 Expect.throws(() { byte_array.setUint64(8, 0); }, 858 Expect.throws(() { byte_array.setUint64(8, 0); },
859 (e) { return e is IndexOutOfRangeException; }); 859 (e) { return e is RangeError; });
860 Expect.throws(() { byte_array.setFloat32(8, 0.0); }, 860 Expect.throws(() { byte_array.setFloat32(8, 0.0); },
861 (e) { return e is IndexOutOfRangeException; }); 861 (e) { return e is RangeError; });
862 Expect.throws(() { byte_array.setFloat64(8, 0.0); }, 862 Expect.throws(() { byte_array.setFloat64(8, 0.0); },
863 (e) { return e is IndexOutOfRangeException; }); 863 (e) { return e is RangeError; });
864 Expect.equals(0, byte_array.getInt8(0)); 864 Expect.equals(0, byte_array.getInt8(0));
865 Expect.equals(0, byte_array.getUint8(0)); 865 Expect.equals(0, byte_array.getUint8(0));
866 Expect.equals(0, byte_array.getInt16(0)); 866 Expect.equals(0, byte_array.getInt16(0));
867 Expect.equals(0, byte_array.getUint16(0)); 867 Expect.equals(0, byte_array.getUint16(0));
868 Expect.equals(0, byte_array.getInt32(0)); 868 Expect.equals(0, byte_array.getInt32(0));
869 Expect.equals(0, byte_array.getUint32(0)); 869 Expect.equals(0, byte_array.getUint32(0));
870 Expect.equals(0, byte_array.getInt64(0)); 870 Expect.equals(0, byte_array.getInt64(0));
871 Expect.equals(0, byte_array.getUint64(0)); 871 Expect.equals(0, byte_array.getUint64(0));
872 Expect.equals(0.0, byte_array.getFloat32(0)); 872 Expect.equals(0.0, byte_array.getFloat32(0));
873 Expect.equals(0.0, byte_array.getFloat64(0)); 873 Expect.equals(0.0, byte_array.getFloat64(0));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 922
923 static testInt8ListView() { 923 static testInt8ListView() {
924 var array = new Uint8List(12); 924 var array = new Uint8List(12);
925 Expect.equals(12, array.length); 925 Expect.equals(12, array.length);
926 Expect.equals(1, array.bytesPerElement()); 926 Expect.equals(1, array.bytesPerElement());
927 Expect.equals(12, array.lengthInBytes()); 927 Expect.equals(12, array.lengthInBytes());
928 for (int i = 0; i < array.length; ++i) { 928 for (int i = 0; i < array.length; ++i) {
929 array[i] = 0xFF; 929 array[i] = 0xFF;
930 } 930 }
931 Expect.throws(() { new Int8List.view(array.asByteArray(), -1); }, 931 Expect.throws(() { new Int8List.view(array.asByteArray(), -1); },
932 (e) { return e is IndexOutOfRangeException; }); 932 (e) { return e is RangeError; });
933 Expect.throws(() { new Int8List.view(array.asByteArray(), 0, -1); }, 933 Expect.throws(() { new Int8List.view(array.asByteArray(), 0, -1); },
934 (e) { return e is IndexOutOfRangeException; }); 934 (e) { return e is RangeError; });
935 Expect.throws(() { new Int8List.view(array.asByteArray(), 935 Expect.throws(() { new Int8List.view(array.asByteArray(),
936 array.lengthInBytes() + 1); }, 936 array.lengthInBytes() + 1); },
937 (e) { return e is IndexOutOfRangeException; }); 937 (e) { return e is RangeError; });
938 Expect.throws(() { new Int8List.view(array.asByteArray(), 938 Expect.throws(() { new Int8List.view(array.asByteArray(),
939 0, array.length + 1); }, 939 0, array.length + 1); },
940 (e) { return e is IndexOutOfRangeException; }); 940 (e) { return e is RangeError; });
941 Expect.throws(() { new Int8List.view(array.asByteArray(), 941 Expect.throws(() { new Int8List.view(array.asByteArray(),
942 array.length - 1, 2); }, 942 array.length - 1, 2); },
943 (e) { return e is IndexOutOfRangeException; }); 943 (e) { return e is RangeError; });
944 var empty = new Int8List.view(array.asByteArray(), 944 var empty = new Int8List.view(array.asByteArray(),
945 array.lengthInBytes()); 945 array.lengthInBytes());
946 Expect.isTrue(empty is List<int>); 946 Expect.isTrue(empty is List<int>);
947 Expect.isTrue(empty is Int8List); 947 Expect.isTrue(empty is Int8List);
948 Expect.equals(0, empty.length); 948 Expect.equals(0, empty.length);
949 var whole = new Int8List.view(array.asByteArray()); 949 var whole = new Int8List.view(array.asByteArray());
950 Expect.isTrue(whole is List<int>); 950 Expect.isTrue(whole is List<int>);
951 Expect.isTrue(whole is Int8List); 951 Expect.isTrue(whole is Int8List);
952 Expect.equals(12, whole.length); 952 Expect.equals(12, whole.length);
953 var view = new Int8List.view(array.asByteArray(), 1, array.length - 2); 953 var view = new Int8List.view(array.asByteArray(), 1, array.length - 2);
954 Expect.isTrue(view is List<int>); 954 Expect.isTrue(view is List<int>);
955 Expect.isTrue(view is Int8List); 955 Expect.isTrue(view is Int8List);
956 Expect.equals(10, view.length); 956 Expect.equals(10, view.length);
957 Expect.equals(1, view.bytesPerElement()); 957 Expect.equals(1, view.bytesPerElement());
958 Expect.equals(10, view.lengthInBytes()); 958 Expect.equals(10, view.lengthInBytes());
959 Expect.listEquals([-1, -1, -1, -1, -1, 959 Expect.listEquals([-1, -1, -1, -1, -1,
960 -1, -1, -1, -1, -1], 960 -1, -1, -1, -1, -1],
961 view); 961 view);
962 Expect.throws(() { view[-1] = 0; }, 962 Expect.throws(() { view[-1] = 0; },
963 (e) { return e is IndexOutOfRangeException; }); 963 (e) { return e is RangeError; });
964 Expect.throws(() { return view[-1]; }, 964 Expect.throws(() { return view[-1]; },
965 (e) { return e is IndexOutOfRangeException; }); 965 (e) { return e is RangeError; });
966 Expect.throws(() { view[view.length]; }, 966 Expect.throws(() { view[view.length]; },
967 (e) { return e is IndexOutOfRangeException; }); 967 (e) { return e is RangeError; });
968 Expect.throws(() { view[10] = 0; }, 968 Expect.throws(() { view[10] = 0; },
969 (e) { return e is IndexOutOfRangeException; }); 969 (e) { return e is RangeError; });
970 Expect.throws(() { view.add(0); }, 970 Expect.throws(() { view.add(0); },
971 (e) { return e is UnsupportedError; }); 971 (e) { return e is UnsupportedError; });
972 Expect.throws(() { view.addAll([0]); }, 972 Expect.throws(() { view.addAll([0]); },
973 (e) { return e is UnsupportedError; }); 973 (e) { return e is UnsupportedError; });
974 Expect.throws(() { view.addLast(0); }, 974 Expect.throws(() { view.addLast(0); },
975 (e) { return e is UnsupportedError; }); 975 (e) { return e is UnsupportedError; });
976 Expect.throws(() { view.clear(); }, 976 Expect.throws(() { view.clear(); },
977 (e) { return e is UnsupportedError; }); 977 (e) { return e is UnsupportedError; });
978 Expect.throws(() { view.insertRange(0, view.length, 0); }, 978 Expect.throws(() { view.insertRange(0, view.length, 0); },
979 (e) { return e is UnsupportedError; }); 979 (e) { return e is UnsupportedError; });
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 static testUint8ListView() { 1050 static testUint8ListView() {
1051 var array = new Int8List(12); 1051 var array = new Int8List(12);
1052 Expect.isTrue(array is List<int>); 1052 Expect.isTrue(array is List<int>);
1053 Expect.equals(12, array.length); 1053 Expect.equals(12, array.length);
1054 Expect.equals(1, array.bytesPerElement()); 1054 Expect.equals(1, array.bytesPerElement());
1055 Expect.equals(12, array.lengthInBytes()); 1055 Expect.equals(12, array.lengthInBytes());
1056 for (int i = 0; i < array.length; ++i) { 1056 for (int i = 0; i < array.length; ++i) {
1057 array[i] = -1; 1057 array[i] = -1;
1058 } 1058 }
1059 Expect.throws(() { new Uint8List.view(array.asByteArray(), -1); }, 1059 Expect.throws(() { new Uint8List.view(array.asByteArray(), -1); },
1060 (e) { return e is IndexOutOfRangeException; }); 1060 (e) { return e is RangeError; });
1061 Expect.throws(() { new Uint8List.view(array.asByteArray(), 0, -1); }, 1061 Expect.throws(() { new Uint8List.view(array.asByteArray(), 0, -1); },
1062 (e) { return e is IndexOutOfRangeException; }); 1062 (e) { return e is RangeError; });
1063 Expect.throws(() { new Uint8List.view(array.asByteArray(), 1063 Expect.throws(() { new Uint8List.view(array.asByteArray(),
1064 array.lengthInBytes() + 1); }, 1064 array.lengthInBytes() + 1); },
1065 (e) { return e is IndexOutOfRangeException; }); 1065 (e) { return e is RangeError; });
1066 Expect.throws(() { new Uint8List.view(array.asByteArray(), 1066 Expect.throws(() { new Uint8List.view(array.asByteArray(),
1067 0, array.length + 1); }, 1067 0, array.length + 1); },
1068 (e) { return e is IndexOutOfRangeException; }); 1068 (e) { return e is RangeError; });
1069 Expect.throws(() { new Uint8List.view(array.asByteArray(), 1069 Expect.throws(() { new Uint8List.view(array.asByteArray(),
1070 array.length - 1, 2); }, 1070 array.length - 1, 2); },
1071 (e) { return e is IndexOutOfRangeException; }); 1071 (e) { return e is RangeError; });
1072 var empty = new Uint8List.view(array.asByteArray(), 1072 var empty = new Uint8List.view(array.asByteArray(),
1073 array.lengthInBytes()); 1073 array.lengthInBytes());
1074 Expect.isTrue(empty is List<int>); 1074 Expect.isTrue(empty is List<int>);
1075 Expect.isTrue(empty is Uint8List); 1075 Expect.isTrue(empty is Uint8List);
1076 Expect.equals(0, empty.length); 1076 Expect.equals(0, empty.length);
1077 var whole = new Uint8List.view(array.asByteArray()); 1077 var whole = new Uint8List.view(array.asByteArray());
1078 Expect.isTrue(whole is List<int>); 1078 Expect.isTrue(whole is List<int>);
1079 Expect.isTrue(whole is Uint8List); 1079 Expect.isTrue(whole is Uint8List);
1080 Expect.equals(12, whole.length); 1080 Expect.equals(12, whole.length);
1081 var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2); 1081 var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2);
1082 Expect.isTrue(view is List<int>); 1082 Expect.isTrue(view is List<int>);
1083 Expect.isTrue(view is Uint8List); 1083 Expect.isTrue(view is Uint8List);
1084 Expect.equals(10, view.length); 1084 Expect.equals(10, view.length);
1085 Expect.equals(1, view.bytesPerElement()); 1085 Expect.equals(1, view.bytesPerElement());
1086 Expect.equals(10, view.lengthInBytes()); 1086 Expect.equals(10, view.lengthInBytes());
1087 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1087 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1088 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], 1088 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
1089 view); 1089 view);
1090 Expect.throws(() { view[-1] = 0; }, 1090 Expect.throws(() { view[-1] = 0; },
1091 (e) { return e is IndexOutOfRangeException; }); 1091 (e) { return e is RangeError; });
1092 Expect.throws(() { return view[-1]; }, 1092 Expect.throws(() { return view[-1]; },
1093 (e) { return e is IndexOutOfRangeException; }); 1093 (e) { return e is RangeError; });
1094 Expect.throws(() { view[view.length]; }, 1094 Expect.throws(() { view[view.length]; },
1095 (e) { return e is IndexOutOfRangeException; }); 1095 (e) { return e is RangeError; });
1096 Expect.throws(() { view[view.length] = 0; }, 1096 Expect.throws(() { view[view.length] = 0; },
1097 (e) { return e is IndexOutOfRangeException; }); 1097 (e) { return e is RangeError; });
1098 Expect.throws(() { view.add(0); }, 1098 Expect.throws(() { view.add(0); },
1099 (e) { return e is UnsupportedError; }); 1099 (e) { return e is UnsupportedError; });
1100 Expect.throws(() { view.addAll([0]); }, 1100 Expect.throws(() { view.addAll([0]); },
1101 (e) { return e is UnsupportedError; }); 1101 (e) { return e is UnsupportedError; });
1102 Expect.throws(() { view.addLast(0); }, 1102 Expect.throws(() { view.addLast(0); },
1103 (e) { return e is UnsupportedError; }); 1103 (e) { return e is UnsupportedError; });
1104 Expect.throws(() { view.clear(); }, 1104 Expect.throws(() { view.clear(); },
1105 (e) { return e is UnsupportedError; }); 1105 (e) { return e is UnsupportedError; });
1106 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1106 Expect.throws(() { view.insertRange(0, view.length, 0); },
1107 (e) { return e is UnsupportedError; }); 1107 (e) { return e is UnsupportedError; });
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 1157
1158 static testInt16ListView() { 1158 static testInt16ListView() {
1159 var array = new Uint8List(24); 1159 var array = new Uint8List(24);
1160 Expect.equals(24, array.length); 1160 Expect.equals(24, array.length);
1161 Expect.equals(1, array.bytesPerElement()); 1161 Expect.equals(1, array.bytesPerElement());
1162 Expect.equals(24, array.lengthInBytes()); 1162 Expect.equals(24, array.lengthInBytes());
1163 for (int i = 0; i < array.length; ++i) { 1163 for (int i = 0; i < array.length; ++i) {
1164 array[i] = 0xFF; 1164 array[i] = 0xFF;
1165 } 1165 }
1166 Expect.throws(() { new Int16List.view(array.asByteArray(), -1); }, 1166 Expect.throws(() { new Int16List.view(array.asByteArray(), -1); },
1167 (e) { return e is IndexOutOfRangeException; }); 1167 (e) { return e is RangeError; });
1168 Expect.throws(() { new Int16List.view(array.asByteArray(), 0, -1); }, 1168 Expect.throws(() { new Int16List.view(array.asByteArray(), 0, -1); },
1169 (e) { return e is IndexOutOfRangeException; }); 1169 (e) { return e is RangeError; });
1170 Expect.throws(() { new Int16List.view(array.asByteArray(), 1170 Expect.throws(() { new Int16List.view(array.asByteArray(),
1171 array.lengthInBytes() + 1); }, 1171 array.lengthInBytes() + 1); },
1172 (e) { return e is IndexOutOfRangeException; }); 1172 (e) { return e is RangeError; });
1173 Expect.throws(() { new Int16List.view(array.asByteArray(), 1173 Expect.throws(() { new Int16List.view(array.asByteArray(),
1174 0, array.length + 1); }, 1174 0, array.length + 1); },
1175 (e) { return e is IndexOutOfRangeException; }); 1175 (e) { return e is RangeError; });
1176 Expect.throws(() { new Int16List.view(array.asByteArray(), 1176 Expect.throws(() { new Int16List.view(array.asByteArray(),
1177 array.length - 1, 2); }, 1177 array.length - 1, 2); },
1178 (e) { return e is IndexOutOfRangeException; }); 1178 (e) { return e is RangeError; });
1179 var empty = new Int16List.view(array.asByteArray(), 1179 var empty = new Int16List.view(array.asByteArray(),
1180 array.lengthInBytes()); 1180 array.lengthInBytes());
1181 Expect.isTrue(empty is List<int>); 1181 Expect.isTrue(empty is List<int>);
1182 Expect.isTrue(empty is Int16List); 1182 Expect.isTrue(empty is Int16List);
1183 Expect.equals(0, empty.length); 1183 Expect.equals(0, empty.length);
1184 var whole = new Int16List.view(array.asByteArray()); 1184 var whole = new Int16List.view(array.asByteArray());
1185 Expect.isTrue(whole is List<int>); 1185 Expect.isTrue(whole is List<int>);
1186 Expect.isTrue(whole is Int16List); 1186 Expect.isTrue(whole is Int16List);
1187 Expect.equals(12, whole.length); 1187 Expect.equals(12, whole.length);
1188 var view = new Int16List.view(array.asByteArray(), 2, 10); 1188 var view = new Int16List.view(array.asByteArray(), 2, 10);
1189 Expect.isTrue(view is List<int>); 1189 Expect.isTrue(view is List<int>);
1190 Expect.isTrue(view is Int16List); 1190 Expect.isTrue(view is Int16List);
1191 Expect.equals(10, view.length); 1191 Expect.equals(10, view.length);
1192 Expect.equals(2, view.bytesPerElement()); 1192 Expect.equals(2, view.bytesPerElement());
1193 Expect.equals(20, view.lengthInBytes()); 1193 Expect.equals(20, view.lengthInBytes());
1194 Expect.listEquals([-1, -1, -1, -1, -1, 1194 Expect.listEquals([-1, -1, -1, -1, -1,
1195 -1, -1, -1, -1, -1], 1195 -1, -1, -1, -1, -1],
1196 view); 1196 view);
1197 Expect.throws(() { view[-1] = 0; }, 1197 Expect.throws(() { view[-1] = 0; },
1198 (e) { return e is IndexOutOfRangeException; }); 1198 (e) { return e is RangeError; });
1199 Expect.throws(() { return view[-1]; }, 1199 Expect.throws(() { return view[-1]; },
1200 (e) { return e is IndexOutOfRangeException; }); 1200 (e) { return e is RangeError; });
1201 Expect.throws(() { view[view.length]; }, 1201 Expect.throws(() { view[view.length]; },
1202 (e) { return e is IndexOutOfRangeException; }); 1202 (e) { return e is RangeError; });
1203 Expect.throws(() { view[10] = 0; }, 1203 Expect.throws(() { view[10] = 0; },
1204 (e) { return e is IndexOutOfRangeException; }); 1204 (e) { return e is RangeError; });
1205 Expect.throws(() { view.add(0); }, 1205 Expect.throws(() { view.add(0); },
1206 (e) { return e is UnsupportedError; }); 1206 (e) { return e is UnsupportedError; });
1207 Expect.throws(() { view.addAll([0]); }, 1207 Expect.throws(() { view.addAll([0]); },
1208 (e) { return e is UnsupportedError; }); 1208 (e) { return e is UnsupportedError; });
1209 Expect.throws(() { view.addLast(0); }, 1209 Expect.throws(() { view.addLast(0); },
1210 (e) { return e is UnsupportedError; }); 1210 (e) { return e is UnsupportedError; });
1211 Expect.throws(() { view.clear(); }, 1211 Expect.throws(() { view.clear(); },
1212 (e) { return e is UnsupportedError; }); 1212 (e) { return e is UnsupportedError; });
1213 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1213 Expect.throws(() { view.insertRange(0, view.length, 0); },
1214 (e) { return e is UnsupportedError; }); 1214 (e) { return e is UnsupportedError; });
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 static testUint16ListView() { 1292 static testUint16ListView() {
1293 var array = new Int8List(24); 1293 var array = new Int8List(24);
1294 Expect.isTrue(array is List<int>); 1294 Expect.isTrue(array is List<int>);
1295 Expect.equals(24, array.length); 1295 Expect.equals(24, array.length);
1296 Expect.equals(1, array.bytesPerElement()); 1296 Expect.equals(1, array.bytesPerElement());
1297 Expect.equals(24, array.lengthInBytes()); 1297 Expect.equals(24, array.lengthInBytes());
1298 for (int i = 0; i < array.length; ++i) { 1298 for (int i = 0; i < array.length; ++i) {
1299 array[i] = -1; 1299 array[i] = -1;
1300 } 1300 }
1301 Expect.throws(() { new Uint16List.view(array.asByteArray(), -1); }, 1301 Expect.throws(() { new Uint16List.view(array.asByteArray(), -1); },
1302 (e) { return e is IndexOutOfRangeException; }); 1302 (e) { return e is RangeError; });
1303 Expect.throws(() { new Uint16List.view(array.asByteArray(), 0, -1); }, 1303 Expect.throws(() { new Uint16List.view(array.asByteArray(), 0, -1); },
1304 (e) { return e is IndexOutOfRangeException; }); 1304 (e) { return e is RangeError; });
1305 Expect.throws(() { new Uint16List.view(array.asByteArray(), 1305 Expect.throws(() { new Uint16List.view(array.asByteArray(),
1306 array.lengthInBytes() + 1); }, 1306 array.lengthInBytes() + 1); },
1307 (e) { return e is IndexOutOfRangeException; }); 1307 (e) { return e is RangeError; });
1308 Expect.throws(() { new Uint16List.view(array.asByteArray(), 1308 Expect.throws(() { new Uint16List.view(array.asByteArray(),
1309 0, array.length + 1); }, 1309 0, array.length + 1); },
1310 (e) { return e is IndexOutOfRangeException; }); 1310 (e) { return e is RangeError; });
1311 Expect.throws(() { new Uint16List.view(array.asByteArray(), 1311 Expect.throws(() { new Uint16List.view(array.asByteArray(),
1312 array.length - 1, 2); }, 1312 array.length - 1, 2); },
1313 (e) { return e is IndexOutOfRangeException; }); 1313 (e) { return e is RangeError; });
1314 var empty = new Uint16List.view(array.asByteArray(), 1314 var empty = new Uint16List.view(array.asByteArray(),
1315 array.lengthInBytes()); 1315 array.lengthInBytes());
1316 Expect.isTrue(empty is List<int>); 1316 Expect.isTrue(empty is List<int>);
1317 Expect.isTrue(empty is Uint16List); 1317 Expect.isTrue(empty is Uint16List);
1318 Expect.equals(0, empty.length); 1318 Expect.equals(0, empty.length);
1319 var whole = new Uint16List.view(array.asByteArray()); 1319 var whole = new Uint16List.view(array.asByteArray());
1320 Expect.isTrue(whole is List<int>); 1320 Expect.isTrue(whole is List<int>);
1321 Expect.isTrue(whole is Uint16List); 1321 Expect.isTrue(whole is Uint16List);
1322 Expect.equals(12, whole.length); 1322 Expect.equals(12, whole.length);
1323 var view = new Uint16List.view(array.asByteArray(), 2, 10); 1323 var view = new Uint16List.view(array.asByteArray(), 2, 10);
1324 Expect.isTrue(view is List<int>); 1324 Expect.isTrue(view is List<int>);
1325 Expect.isTrue(view is Uint16List); 1325 Expect.isTrue(view is Uint16List);
1326 Expect.equals(10, view.length); 1326 Expect.equals(10, view.length);
1327 Expect.equals(2, view.bytesPerElement()); 1327 Expect.equals(2, view.bytesPerElement());
1328 Expect.equals(20, view.lengthInBytes()); 1328 Expect.equals(20, view.lengthInBytes());
1329 Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 1329 Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
1330 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF], 1330 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF],
1331 view); 1331 view);
1332 Expect.throws(() { view[-1] = 0; }, 1332 Expect.throws(() { view[-1] = 0; },
1333 (e) { return e is IndexOutOfRangeException; }); 1333 (e) { return e is RangeError; });
1334 Expect.throws(() { return view[-1]; }, 1334 Expect.throws(() { return view[-1]; },
1335 (e) { return e is IndexOutOfRangeException; }); 1335 (e) { return e is RangeError; });
1336 Expect.throws(() { view[view.length]; }, 1336 Expect.throws(() { view[view.length]; },
1337 (e) { return e is IndexOutOfRangeException; }); 1337 (e) { return e is RangeError; });
1338 Expect.throws(() { view[view.length] = 0; }, 1338 Expect.throws(() { view[view.length] = 0; },
1339 (e) { return e is IndexOutOfRangeException; }); 1339 (e) { return e is RangeError; });
1340 Expect.throws(() { view.add(0); }, 1340 Expect.throws(() { view.add(0); },
1341 (e) { return e is UnsupportedError; }); 1341 (e) { return e is UnsupportedError; });
1342 Expect.throws(() { view.addAll([0]); }, 1342 Expect.throws(() { view.addAll([0]); },
1343 (e) { return e is UnsupportedError; }); 1343 (e) { return e is UnsupportedError; });
1344 Expect.throws(() { view.addLast(0); }, 1344 Expect.throws(() { view.addLast(0); },
1345 (e) { return e is UnsupportedError; }); 1345 (e) { return e is UnsupportedError; });
1346 Expect.throws(() { view.clear(); }, 1346 Expect.throws(() { view.clear(); },
1347 (e) { return e is UnsupportedError; }); 1347 (e) { return e is UnsupportedError; });
1348 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1348 Expect.throws(() { view.insertRange(0, view.length, 0); },
1349 (e) { return e is UnsupportedError; }); 1349 (e) { return e is UnsupportedError; });
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 1404
1405 static testInt32ListView() { 1405 static testInt32ListView() {
1406 var array = new Uint8List(48); 1406 var array = new Uint8List(48);
1407 Expect.equals(48, array.length); 1407 Expect.equals(48, array.length);
1408 Expect.equals(1, array.bytesPerElement()); 1408 Expect.equals(1, array.bytesPerElement());
1409 Expect.equals(48, array.lengthInBytes()); 1409 Expect.equals(48, array.lengthInBytes());
1410 for (int i = 0; i < array.length; ++i) { 1410 for (int i = 0; i < array.length; ++i) {
1411 array[i] = 0xFF; 1411 array[i] = 0xFF;
1412 } 1412 }
1413 Expect.throws(() { new Int32List.view(array.asByteArray(), -1); }, 1413 Expect.throws(() { new Int32List.view(array.asByteArray(), -1); },
1414 (e) { return e is IndexOutOfRangeException; }); 1414 (e) { return e is RangeError; });
1415 Expect.throws(() { new Int32List.view(array.asByteArray(), 0, -1); }, 1415 Expect.throws(() { new Int32List.view(array.asByteArray(), 0, -1); },
1416 (e) { return e is IndexOutOfRangeException; }); 1416 (e) { return e is RangeError; });
1417 Expect.throws(() { new Int32List.view(array.asByteArray(), 1417 Expect.throws(() { new Int32List.view(array.asByteArray(),
1418 array.lengthInBytes() + 1); }, 1418 array.lengthInBytes() + 1); },
1419 (e) { return e is IndexOutOfRangeException; }); 1419 (e) { return e is RangeError; });
1420 Expect.throws(() { new Int32List.view(array.asByteArray(), 1420 Expect.throws(() { new Int32List.view(array.asByteArray(),
1421 0, array.length + 1); }, 1421 0, array.length + 1); },
1422 (e) { return e is IndexOutOfRangeException; }); 1422 (e) { return e is RangeError; });
1423 Expect.throws(() { new Int32List.view(array.asByteArray(), 1423 Expect.throws(() { new Int32List.view(array.asByteArray(),
1424 array.length - 1, 2); }, 1424 array.length - 1, 2); },
1425 (e) { return e is IndexOutOfRangeException; }); 1425 (e) { return e is RangeError; });
1426 var empty = new Int32List.view(array.asByteArray(), 1426 var empty = new Int32List.view(array.asByteArray(),
1427 array.lengthInBytes()); 1427 array.lengthInBytes());
1428 Expect.isTrue(empty is List<int>); 1428 Expect.isTrue(empty is List<int>);
1429 Expect.isTrue(empty is Int32List); 1429 Expect.isTrue(empty is Int32List);
1430 Expect.equals(0, empty.length); 1430 Expect.equals(0, empty.length);
1431 var whole = new Int32List.view(array.asByteArray()); 1431 var whole = new Int32List.view(array.asByteArray());
1432 Expect.isTrue(whole is List<int>); 1432 Expect.isTrue(whole is List<int>);
1433 Expect.isTrue(whole is Int32List); 1433 Expect.isTrue(whole is Int32List);
1434 Expect.equals(12, whole.length); 1434 Expect.equals(12, whole.length);
1435 var view = new Int32List.view(array.asByteArray(), 4, 10); 1435 var view = new Int32List.view(array.asByteArray(), 4, 10);
1436 Expect.isTrue(view is List<int>); 1436 Expect.isTrue(view is List<int>);
1437 Expect.isTrue(view is Int32List); 1437 Expect.isTrue(view is Int32List);
1438 Expect.equals(10, view.length); 1438 Expect.equals(10, view.length);
1439 Expect.equals(4, view.bytesPerElement()); 1439 Expect.equals(4, view.bytesPerElement());
1440 Expect.equals(40, view.lengthInBytes()); 1440 Expect.equals(40, view.lengthInBytes());
1441 Expect.listEquals([-1, -1, -1, -1, -1, 1441 Expect.listEquals([-1, -1, -1, -1, -1,
1442 -1, -1, -1, -1, -1], 1442 -1, -1, -1, -1, -1],
1443 view); 1443 view);
1444 Expect.throws(() { view[-1] = 0; }, 1444 Expect.throws(() { view[-1] = 0; },
1445 (e) { return e is IndexOutOfRangeException; }); 1445 (e) { return e is RangeError; });
1446 Expect.throws(() { return view[-1]; }, 1446 Expect.throws(() { return view[-1]; },
1447 (e) { return e is IndexOutOfRangeException; }); 1447 (e) { return e is RangeError; });
1448 Expect.throws(() { view[view.length]; }, 1448 Expect.throws(() { view[view.length]; },
1449 (e) { return e is IndexOutOfRangeException; }); 1449 (e) { return e is RangeError; });
1450 Expect.throws(() { view[10] = 0; }, 1450 Expect.throws(() { view[10] = 0; },
1451 (e) { return e is IndexOutOfRangeException; }); 1451 (e) { return e is RangeError; });
1452 Expect.throws(() { view.add(0); }, 1452 Expect.throws(() { view.add(0); },
1453 (e) { return e is UnsupportedError; }); 1453 (e) { return e is UnsupportedError; });
1454 Expect.throws(() { view.addAll([0]); }, 1454 Expect.throws(() { view.addAll([0]); },
1455 (e) { return e is UnsupportedError; }); 1455 (e) { return e is UnsupportedError; });
1456 Expect.throws(() { view.addLast(0); }, 1456 Expect.throws(() { view.addLast(0); },
1457 (e) { return e is UnsupportedError; }); 1457 (e) { return e is UnsupportedError; });
1458 Expect.throws(() { view.clear(); }, 1458 Expect.throws(() { view.clear(); },
1459 (e) { return e is UnsupportedError; }); 1459 (e) { return e is UnsupportedError; });
1460 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1460 Expect.throws(() { view.insertRange(0, view.length, 0); },
1461 (e) { return e is UnsupportedError; }); 1461 (e) { return e is UnsupportedError; });
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 static testUint32ListView() { 1563 static testUint32ListView() {
1564 var array = new Int8List(48); 1564 var array = new Int8List(48);
1565 Expect.isTrue(array is List<int>); 1565 Expect.isTrue(array is List<int>);
1566 Expect.equals(48, array.length); 1566 Expect.equals(48, array.length);
1567 Expect.equals(1, array.bytesPerElement()); 1567 Expect.equals(1, array.bytesPerElement());
1568 Expect.equals(48, array.lengthInBytes()); 1568 Expect.equals(48, array.lengthInBytes());
1569 for (int i = 0; i < array.length; ++i) { 1569 for (int i = 0; i < array.length; ++i) {
1570 array[i] = -1; 1570 array[i] = -1;
1571 } 1571 }
1572 Expect.throws(() { new Uint32List.view(array.asByteArray(), -1); }, 1572 Expect.throws(() { new Uint32List.view(array.asByteArray(), -1); },
1573 (e) { return e is IndexOutOfRangeException; }); 1573 (e) { return e is RangeError; });
1574 Expect.throws(() { new Uint32List.view(array.asByteArray(), 0, -1); }, 1574 Expect.throws(() { new Uint32List.view(array.asByteArray(), 0, -1); },
1575 (e) { return e is IndexOutOfRangeException; }); 1575 (e) { return e is RangeError; });
1576 Expect.throws(() { new Uint32List.view(array.asByteArray(), 1576 Expect.throws(() { new Uint32List.view(array.asByteArray(),
1577 array.lengthInBytes() + 1); }, 1577 array.lengthInBytes() + 1); },
1578 (e) { return e is IndexOutOfRangeException; }); 1578 (e) { return e is RangeError; });
1579 Expect.throws(() { new Uint32List.view(array.asByteArray(), 1579 Expect.throws(() { new Uint32List.view(array.asByteArray(),
1580 0, array.length + 1); }, 1580 0, array.length + 1); },
1581 (e) { return e is IndexOutOfRangeException; }); 1581 (e) { return e is RangeError; });
1582 Expect.throws(() { new Uint32List.view(array.asByteArray(), 1582 Expect.throws(() { new Uint32List.view(array.asByteArray(),
1583 array.length - 1, 2); }, 1583 array.length - 1, 2); },
1584 (e) { return e is IndexOutOfRangeException; }); 1584 (e) { return e is RangeError; });
1585 var empty = new Uint32List.view(array.asByteArray(), 1585 var empty = new Uint32List.view(array.asByteArray(),
1586 array.lengthInBytes()); 1586 array.lengthInBytes());
1587 Expect.isTrue(empty is List<int>); 1587 Expect.isTrue(empty is List<int>);
1588 Expect.isTrue(empty is Uint32List); 1588 Expect.isTrue(empty is Uint32List);
1589 Expect.equals(0, empty.length); 1589 Expect.equals(0, empty.length);
1590 var whole = new Uint32List.view(array.asByteArray()); 1590 var whole = new Uint32List.view(array.asByteArray());
1591 Expect.isTrue(whole is List<int>); 1591 Expect.isTrue(whole is List<int>);
1592 Expect.isTrue(whole is Uint32List); 1592 Expect.isTrue(whole is Uint32List);
1593 Expect.equals(12, whole.length); 1593 Expect.equals(12, whole.length);
1594 var view = new Uint32List.view(array.asByteArray(), 4, 10); 1594 var view = new Uint32List.view(array.asByteArray(), 4, 10);
1595 Expect.isTrue(view is List<int>); 1595 Expect.isTrue(view is List<int>);
1596 Expect.isTrue(view is Uint32List); 1596 Expect.isTrue(view is Uint32List);
1597 Expect.equals(10, view.length); 1597 Expect.equals(10, view.length);
1598 Expect.equals(4, view.bytesPerElement()); 1598 Expect.equals(4, view.bytesPerElement());
1599 Expect.equals(40, view.lengthInBytes()); 1599 Expect.equals(40, view.lengthInBytes());
1600 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F, 1600 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F,
1601 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F], 1601 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F],
1602 view); 1602 view);
1603 Expect.throws(() { view[-1] = 0; }, 1603 Expect.throws(() { view[-1] = 0; },
1604 (e) { return e is IndexOutOfRangeException; }); 1604 (e) { return e is RangeError; });
1605 Expect.throws(() { return view[-1]; }, 1605 Expect.throws(() { return view[-1]; },
1606 (e) { return e is IndexOutOfRangeException; }); 1606 (e) { return e is RangeError; });
1607 Expect.throws(() { view[view.length]; }, 1607 Expect.throws(() { view[view.length]; },
1608 (e) { return e is IndexOutOfRangeException; }); 1608 (e) { return e is RangeError; });
1609 Expect.throws(() { view[view.length] = 0; }, 1609 Expect.throws(() { view[view.length] = 0; },
1610 (e) { return e is IndexOutOfRangeException; }); 1610 (e) { return e is RangeError; });
1611 Expect.throws(() { view.add(0); }, 1611 Expect.throws(() { view.add(0); },
1612 (e) { return e is UnsupportedError; }); 1612 (e) { return e is UnsupportedError; });
1613 Expect.throws(() { view.addAll([0]); }, 1613 Expect.throws(() { view.addAll([0]); },
1614 (e) { return e is UnsupportedError; }); 1614 (e) { return e is UnsupportedError; });
1615 Expect.throws(() { view.addLast(0); }, 1615 Expect.throws(() { view.addLast(0); },
1616 (e) { return e is UnsupportedError; }); 1616 (e) { return e is UnsupportedError; });
1617 Expect.throws(() { view.clear(); }, 1617 Expect.throws(() { view.clear(); },
1618 (e) { return e is UnsupportedError; }); 1618 (e) { return e is UnsupportedError; });
1619 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1619 Expect.throws(() { view.insertRange(0, view.length, 0); },
1620 (e) { return e is UnsupportedError; }); 1620 (e) { return e is UnsupportedError; });
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 1692
1693 static testInt64ListView() { 1693 static testInt64ListView() {
1694 var array = new Uint8List(96); 1694 var array = new Uint8List(96);
1695 Expect.equals(96, array.length); 1695 Expect.equals(96, array.length);
1696 Expect.equals(1, array.bytesPerElement()); 1696 Expect.equals(1, array.bytesPerElement());
1697 Expect.equals(96, array.lengthInBytes()); 1697 Expect.equals(96, array.lengthInBytes());
1698 for (int i = 0; i < array.length; ++i) { 1698 for (int i = 0; i < array.length; ++i) {
1699 array[i] = 0xFF; 1699 array[i] = 0xFF;
1700 } 1700 }
1701 Expect.throws(() { new Int64List.view(array.asByteArray(), -1); }, 1701 Expect.throws(() { new Int64List.view(array.asByteArray(), -1); },
1702 (e) { return e is IndexOutOfRangeException; }); 1702 (e) { return e is RangeError; });
1703 Expect.throws(() { new Int64List.view(array.asByteArray(), 0, -1); }, 1703 Expect.throws(() { new Int64List.view(array.asByteArray(), 0, -1); },
1704 (e) { return e is IndexOutOfRangeException; }); 1704 (e) { return e is RangeError; });
1705 Expect.throws(() { new Int64List.view(array.asByteArray(), 1705 Expect.throws(() { new Int64List.view(array.asByteArray(),
1706 array.lengthInBytes() + 1); }, 1706 array.lengthInBytes() + 1); },
1707 (e) { return e is IndexOutOfRangeException; }); 1707 (e) { return e is RangeError; });
1708 Expect.throws(() { new Int64List.view(array.asByteArray(), 1708 Expect.throws(() { new Int64List.view(array.asByteArray(),
1709 0, array.length + 1); }, 1709 0, array.length + 1); },
1710 (e) { return e is IndexOutOfRangeException; }); 1710 (e) { return e is RangeError; });
1711 Expect.throws(() { new Int64List.view(array.asByteArray(), 1711 Expect.throws(() { new Int64List.view(array.asByteArray(),
1712 array.length - 1, 2); }, 1712 array.length - 1, 2); },
1713 (e) { return e is IndexOutOfRangeException; }); 1713 (e) { return e is RangeError; });
1714 var empty = new Int64List.view(array.asByteArray(), 1714 var empty = new Int64List.view(array.asByteArray(),
1715 array.lengthInBytes()); 1715 array.lengthInBytes());
1716 Expect.isTrue(empty is List<int>); 1716 Expect.isTrue(empty is List<int>);
1717 Expect.isTrue(empty is Int64List); 1717 Expect.isTrue(empty is Int64List);
1718 Expect.equals(0, empty.length); 1718 Expect.equals(0, empty.length);
1719 var whole = new Int64List.view(array.asByteArray()); 1719 var whole = new Int64List.view(array.asByteArray());
1720 Expect.isTrue(whole is List<int>); 1720 Expect.isTrue(whole is List<int>);
1721 Expect.isTrue(whole is Int64List); 1721 Expect.isTrue(whole is Int64List);
1722 Expect.equals(12, whole.length); 1722 Expect.equals(12, whole.length);
1723 var view = new Int64List.view(array.asByteArray(), 8, 10); 1723 var view = new Int64List.view(array.asByteArray(), 8, 10);
1724 Expect.isTrue(view is List<int>); 1724 Expect.isTrue(view is List<int>);
1725 Expect.isTrue(view is Int64List); 1725 Expect.isTrue(view is Int64List);
1726 Expect.equals(10, view.length); 1726 Expect.equals(10, view.length);
1727 Expect.equals(8, view.bytesPerElement()); 1727 Expect.equals(8, view.bytesPerElement());
1728 Expect.equals(80, view.lengthInBytes()); 1728 Expect.equals(80, view.lengthInBytes());
1729 Expect.listEquals([-1, -1, -1, -1, -1, 1729 Expect.listEquals([-1, -1, -1, -1, -1,
1730 -1, -1, -1, -1, -1], 1730 -1, -1, -1, -1, -1],
1731 view); 1731 view);
1732 Expect.throws(() { view[-1] = 0; }, 1732 Expect.throws(() { view[-1] = 0; },
1733 (e) { return e is IndexOutOfRangeException; }); 1733 (e) { return e is RangeError; });
1734 Expect.throws(() { return view[-1]; }, 1734 Expect.throws(() { return view[-1]; },
1735 (e) { return e is IndexOutOfRangeException; }); 1735 (e) { return e is RangeError; });
1736 Expect.throws(() { view[view.length]; }, 1736 Expect.throws(() { view[view.length]; },
1737 (e) { return e is IndexOutOfRangeException; }); 1737 (e) { return e is RangeError; });
1738 Expect.throws(() { view[10] = 0; }, 1738 Expect.throws(() { view[10] = 0; },
1739 (e) { return e is IndexOutOfRangeException; }); 1739 (e) { return e is RangeError; });
1740 Expect.throws(() { view.add(0); }, 1740 Expect.throws(() { view.add(0); },
1741 (e) { return e is UnsupportedError; }); 1741 (e) { return e is UnsupportedError; });
1742 Expect.throws(() { view.addAll([0]); }, 1742 Expect.throws(() { view.addAll([0]); },
1743 (e) { return e is UnsupportedError; }); 1743 (e) { return e is UnsupportedError; });
1744 Expect.throws(() { view.addLast(0); }, 1744 Expect.throws(() { view.addLast(0); },
1745 (e) { return e is UnsupportedError; }); 1745 (e) { return e is UnsupportedError; });
1746 Expect.throws(() { view.clear(); }, 1746 Expect.throws(() { view.clear(); },
1747 (e) { return e is UnsupportedError; }); 1747 (e) { return e is UnsupportedError; });
1748 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1748 Expect.throws(() { view.insertRange(0, view.length, 0); },
1749 (e) { return e is UnsupportedError; }); 1749 (e) { return e is UnsupportedError; });
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 static testUint64ListView() { 1888 static testUint64ListView() {
1889 var array = new Int8List(96); 1889 var array = new Int8List(96);
1890 Expect.isTrue(array is List<int>); 1890 Expect.isTrue(array is List<int>);
1891 Expect.equals(96, array.length); 1891 Expect.equals(96, array.length);
1892 Expect.equals(1, array.bytesPerElement()); 1892 Expect.equals(1, array.bytesPerElement());
1893 Expect.equals(96, array.lengthInBytes()); 1893 Expect.equals(96, array.lengthInBytes());
1894 for (int i = 0; i < array.length; ++i) { 1894 for (int i = 0; i < array.length; ++i) {
1895 array[i] = -1; 1895 array[i] = -1;
1896 } 1896 }
1897 Expect.throws(() { new Uint64List.view(array.asByteArray(), -1); }, 1897 Expect.throws(() { new Uint64List.view(array.asByteArray(), -1); },
1898 (e) { return e is IndexOutOfRangeException; }); 1898 (e) { return e is RangeError; });
1899 Expect.throws(() { new Uint64List.view(array.asByteArray(), 0, -1); }, 1899 Expect.throws(() { new Uint64List.view(array.asByteArray(), 0, -1); },
1900 (e) { return e is IndexOutOfRangeException; }); 1900 (e) { return e is RangeError; });
1901 Expect.throws(() { new Uint64List.view(array.asByteArray(), 1901 Expect.throws(() { new Uint64List.view(array.asByteArray(),
1902 array.lengthInBytes() + 1); }, 1902 array.lengthInBytes() + 1); },
1903 (e) { return e is IndexOutOfRangeException; }); 1903 (e) { return e is RangeError; });
1904 Expect.throws(() { new Uint64List.view(array.asByteArray(), 1904 Expect.throws(() { new Uint64List.view(array.asByteArray(),
1905 0, array.length + 1); }, 1905 0, array.length + 1); },
1906 (e) { return e is IndexOutOfRangeException; }); 1906 (e) { return e is RangeError; });
1907 Expect.throws(() { new Uint64List.view(array.asByteArray(), 1907 Expect.throws(() { new Uint64List.view(array.asByteArray(),
1908 array.length - 1, 2); }, 1908 array.length - 1, 2); },
1909 (e) { return e is IndexOutOfRangeException; }); 1909 (e) { return e is RangeError; });
1910 var empty = new Uint64List.view(array.asByteArray(), 1910 var empty = new Uint64List.view(array.asByteArray(),
1911 array.lengthInBytes()); 1911 array.lengthInBytes());
1912 Expect.isTrue(empty is List<int>); 1912 Expect.isTrue(empty is List<int>);
1913 Expect.isTrue(empty is Uint64List); 1913 Expect.isTrue(empty is Uint64List);
1914 Expect.equals(0, empty.length); 1914 Expect.equals(0, empty.length);
1915 var whole = new Uint64List.view(array.asByteArray()); 1915 var whole = new Uint64List.view(array.asByteArray());
1916 Expect.isTrue(whole is List<int>); 1916 Expect.isTrue(whole is List<int>);
1917 Expect.isTrue(whole is Uint64List); 1917 Expect.isTrue(whole is Uint64List);
1918 Expect.equals(12, whole.length); 1918 Expect.equals(12, whole.length);
1919 var view = new Uint64List.view(array.asByteArray(), 8, 10); 1919 var view = new Uint64List.view(array.asByteArray(), 8, 10);
1920 Expect.isTrue(view is List<int>); 1920 Expect.isTrue(view is List<int>);
1921 Expect.isTrue(view is Uint64List); 1921 Expect.isTrue(view is Uint64List);
1922 Expect.equals(10, view.length); 1922 Expect.equals(10, view.length);
1923 Expect.equals(8, view.bytesPerElement()); 1923 Expect.equals(8, view.bytesPerElement());
1924 Expect.equals(80, view.lengthInBytes()); 1924 Expect.equals(80, view.lengthInBytes());
1925 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1925 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1926 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1926 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1927 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1927 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1928 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1928 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1929 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF], 1929 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF],
1930 view); 1930 view);
1931 Expect.throws(() { view[-1] = 0; }, 1931 Expect.throws(() { view[-1] = 0; },
1932 (e) { return e is IndexOutOfRangeException; }); 1932 (e) { return e is RangeError; });
1933 Expect.throws(() { return view[-1]; }, 1933 Expect.throws(() { return view[-1]; },
1934 (e) { return e is IndexOutOfRangeException; }); 1934 (e) { return e is RangeError; });
1935 Expect.throws(() { view[view.length]; }, 1935 Expect.throws(() { view[view.length]; },
1936 (e) { return e is IndexOutOfRangeException; }); 1936 (e) { return e is RangeError; });
1937 Expect.throws(() { view[view.length] = 0; }, 1937 Expect.throws(() { view[view.length] = 0; },
1938 (e) { return e is IndexOutOfRangeException; }); 1938 (e) { return e is RangeError; });
1939 Expect.throws(() { view.add(0); }, 1939 Expect.throws(() { view.add(0); },
1940 (e) { return e is UnsupportedError; }); 1940 (e) { return e is UnsupportedError; });
1941 Expect.throws(() { view.addAll([0]); }, 1941 Expect.throws(() { view.addAll([0]); },
1942 (e) { return e is UnsupportedError; }); 1942 (e) { return e is UnsupportedError; });
1943 Expect.throws(() { view.addLast(0); }, 1943 Expect.throws(() { view.addLast(0); },
1944 (e) { return e is UnsupportedError; }); 1944 (e) { return e is UnsupportedError; });
1945 Expect.throws(() { view.clear(); }, 1945 Expect.throws(() { view.clear(); },
1946 (e) { return e is UnsupportedError; }); 1946 (e) { return e is UnsupportedError; });
1947 Expect.throws(() { view.insertRange(0, view.length, 0); }, 1947 Expect.throws(() { view.insertRange(0, view.length, 0); },
1948 (e) { return e is UnsupportedError; }); 1948 (e) { return e is UnsupportedError; });
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 static testFloat32ListView() { 2045 static testFloat32ListView() {
2046 var array = new Uint32List(12); 2046 var array = new Uint32List(12);
2047 Expect.isTrue(array is List<int>); 2047 Expect.isTrue(array is List<int>);
2048 Expect.equals(12, array.length); 2048 Expect.equals(12, array.length);
2049 Expect.equals(4, array.bytesPerElement()); 2049 Expect.equals(4, array.bytesPerElement());
2050 Expect.equals(48, array.lengthInBytes()); 2050 Expect.equals(48, array.lengthInBytes());
2051 for (int i = 0; i < array.length; ++i) { 2051 for (int i = 0; i < array.length; ++i) {
2052 array[i] = 0xBF800000; 2052 array[i] = 0xBF800000;
2053 } 2053 }
2054 Expect.throws(() { new Float32List.view(array.asByteArray(), -1); }, 2054 Expect.throws(() { new Float32List.view(array.asByteArray(), -1); },
2055 (e) { return e is IndexOutOfRangeException; }); 2055 (e) { return e is RangeError; });
2056 Expect.throws(() { new Float32List.view(array.asByteArray(), 0, -1); }, 2056 Expect.throws(() { new Float32List.view(array.asByteArray(), 0, -1); },
2057 (e) { return e is IndexOutOfRangeException; }); 2057 (e) { return e is RangeError; });
2058 Expect.throws(() { new Float32List.view(array.asByteArray(), 2058 Expect.throws(() { new Float32List.view(array.asByteArray(),
2059 array.lengthInBytes() + 1); }, 2059 array.lengthInBytes() + 1); },
2060 (e) { return e is IndexOutOfRangeException; }); 2060 (e) { return e is RangeError; });
2061 Expect.throws(() { new Float32List.view(array.asByteArray(), 2061 Expect.throws(() { new Float32List.view(array.asByteArray(),
2062 0, array.lengthInBytes() + 1); }, 2062 0, array.lengthInBytes() + 1); },
2063 (e) { return e is IndexOutOfRangeException; }); 2063 (e) { return e is RangeError; });
2064 Expect.throws(() { new Float32List.view(array.asByteArray(), 2064 Expect.throws(() { new Float32List.view(array.asByteArray(),
2065 array.lengthInBytes() - 1, 2); }, 2065 array.lengthInBytes() - 1, 2); },
2066 (e) { return e is IndexOutOfRangeException; }); 2066 (e) { return e is RangeError; });
2067 var empty = new Float32List.view(array.asByteArray(), 2067 var empty = new Float32List.view(array.asByteArray(),
2068 array.lengthInBytes()); 2068 array.lengthInBytes());
2069 Expect.isTrue(empty is List<double>); 2069 Expect.isTrue(empty is List<double>);
2070 Expect.isTrue(empty is Float32List); 2070 Expect.isTrue(empty is Float32List);
2071 Expect.equals(0, empty.length); 2071 Expect.equals(0, empty.length);
2072 var whole = new Float32List.view(array.asByteArray()); 2072 var whole = new Float32List.view(array.asByteArray());
2073 Expect.isTrue(whole is List<double>); 2073 Expect.isTrue(whole is List<double>);
2074 Expect.isTrue(whole is Float32List); 2074 Expect.isTrue(whole is Float32List);
2075 Expect.equals(12, whole.length); 2075 Expect.equals(12, whole.length);
2076 var view = new Float32List.view(array.asByteArray(), 4, 10); 2076 var view = new Float32List.view(array.asByteArray(), 4, 10);
2077 Expect.isTrue(view is List<double>); 2077 Expect.isTrue(view is List<double>);
2078 Expect.isTrue(view is Float32List); 2078 Expect.isTrue(view is Float32List);
2079 Expect.equals(10, view.length); 2079 Expect.equals(10, view.length);
2080 Expect.equals(4, view.bytesPerElement()); 2080 Expect.equals(4, view.bytesPerElement());
2081 Expect.equals(40, view.lengthInBytes()); 2081 Expect.equals(40, view.lengthInBytes());
2082 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, 2082 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0,
2083 -1.0, -1.0, -1.0, -1.0, -1.0], 2083 -1.0, -1.0, -1.0, -1.0, -1.0],
2084 view); 2084 view);
2085 Expect.throws(() { view[-1] = 0.0; }, 2085 Expect.throws(() { view[-1] = 0.0; },
2086 (e) { return e is IndexOutOfRangeException; }); 2086 (e) { return e is RangeError; });
2087 Expect.throws(() { return view[-1]; }, 2087 Expect.throws(() { return view[-1]; },
2088 (e) { return e is IndexOutOfRangeException; }); 2088 (e) { return e is RangeError; });
2089 Expect.throws(() { view[10]; }, 2089 Expect.throws(() { view[10]; },
2090 (e) { return e is IndexOutOfRangeException; }); 2090 (e) { return e is RangeError; });
2091 Expect.throws(() { view[10] = 0.0; }, 2091 Expect.throws(() { view[10] = 0.0; },
2092 (e) { return e is IndexOutOfRangeException; }); 2092 (e) { return e is RangeError; });
2093 Expect.throws(() { array.add(0.0); }, 2093 Expect.throws(() { array.add(0.0); },
2094 (e) { return e is UnsupportedError; }); 2094 (e) { return e is UnsupportedError; });
2095 Expect.throws(() { array.addAll([0]); }, 2095 Expect.throws(() { array.addAll([0]); },
2096 (e) { return e is UnsupportedError; }); 2096 (e) { return e is UnsupportedError; });
2097 Expect.throws(() { array.addLast(0.0); }, 2097 Expect.throws(() { array.addLast(0.0); },
2098 (e) { return e is UnsupportedError; }); 2098 (e) { return e is UnsupportedError; });
2099 Expect.throws(() { array.clear(); }, 2099 Expect.throws(() { array.clear(); },
2100 (e) { return e is UnsupportedError; }); 2100 (e) { return e is UnsupportedError; });
2101 Expect.throws(() { array.insertRange(0, array.length, 0.0); }, 2101 Expect.throws(() { array.insertRange(0, array.length, 0.0); },
2102 (e) { return e is UnsupportedError; }); 2102 (e) { return e is UnsupportedError; });
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 static testFloat64ListView() { 2148 static testFloat64ListView() {
2149 var array = new Uint64List(12); 2149 var array = new Uint64List(12);
2150 Expect.isTrue(array is List<int>); 2150 Expect.isTrue(array is List<int>);
2151 Expect.equals(12, array.length); 2151 Expect.equals(12, array.length);
2152 Expect.equals(8, array.bytesPerElement()); 2152 Expect.equals(8, array.bytesPerElement());
2153 Expect.equals(96, array.lengthInBytes()); 2153 Expect.equals(96, array.lengthInBytes());
2154 for (int i = 0; i < array.length; ++i) { 2154 for (int i = 0; i < array.length; ++i) {
2155 array[i] = 0xBFF0000000000000; 2155 array[i] = 0xBFF0000000000000;
2156 } 2156 }
2157 Expect.throws(() { new Float64List.view(array.asByteArray(), -1); }, 2157 Expect.throws(() { new Float64List.view(array.asByteArray(), -1); },
2158 (e) { return e is IndexOutOfRangeException; }); 2158 (e) { return e is RangeError; });
2159 Expect.throws(() { new Float64List.view(array.asByteArray(), 0, -1); }, 2159 Expect.throws(() { new Float64List.view(array.asByteArray(), 0, -1); },
2160 (e) { return e is IndexOutOfRangeException; }); 2160 (e) { return e is RangeError; });
2161 Expect.throws(() { new Float64List.view(array.asByteArray(), 2161 Expect.throws(() { new Float64List.view(array.asByteArray(),
2162 array.lengthInBytes() + 1); }, 2162 array.lengthInBytes() + 1); },
2163 (e) { return e is IndexOutOfRangeException; }); 2163 (e) { return e is RangeError; });
2164 Expect.throws(() { new Float64List.view(array.asByteArray(), 2164 Expect.throws(() { new Float64List.view(array.asByteArray(),
2165 0, array.lengthInBytes() + 1); }, 2165 0, array.lengthInBytes() + 1); },
2166 (e) { return e is IndexOutOfRangeException; }); 2166 (e) { return e is RangeError; });
2167 Expect.throws(() { new Float64List.view(array.asByteArray(), 2167 Expect.throws(() { new Float64List.view(array.asByteArray(),
2168 array.lengthInBytes() - 1, 2); }, 2168 array.lengthInBytes() - 1, 2); },
2169 (e) { return e is IndexOutOfRangeException; }); 2169 (e) { return e is RangeError; });
2170 var empty = new Float64List.view(array.asByteArray(), 2170 var empty = new Float64List.view(array.asByteArray(),
2171 array.lengthInBytes()); 2171 array.lengthInBytes());
2172 Expect.isTrue(empty is List<double>); 2172 Expect.isTrue(empty is List<double>);
2173 Expect.isTrue(empty is Float64List); 2173 Expect.isTrue(empty is Float64List);
2174 Expect.equals(0, empty.length); 2174 Expect.equals(0, empty.length);
2175 var whole = new Float64List.view(array.asByteArray()); 2175 var whole = new Float64List.view(array.asByteArray());
2176 Expect.isTrue(whole is List<double>); 2176 Expect.isTrue(whole is List<double>);
2177 Expect.isTrue(whole is Float64List); 2177 Expect.isTrue(whole is Float64List);
2178 Expect.equals(12, whole.length); 2178 Expect.equals(12, whole.length);
2179 var view = new Float64List.view(array.asByteArray(), 8, 10); 2179 var view = new Float64List.view(array.asByteArray(), 8, 10);
2180 Expect.isTrue(view is List<double>); 2180 Expect.isTrue(view is List<double>);
2181 Expect.isTrue(view is Float64List); 2181 Expect.isTrue(view is Float64List);
2182 Expect.equals(10, view.length); 2182 Expect.equals(10, view.length);
2183 Expect.equals(8, view.bytesPerElement()); 2183 Expect.equals(8, view.bytesPerElement());
2184 Expect.equals(80, view.lengthInBytes()); 2184 Expect.equals(80, view.lengthInBytes());
2185 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, 2185 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0,
2186 -1.0, -1.0, -1.0, -1.0, -1.0], 2186 -1.0, -1.0, -1.0, -1.0, -1.0],
2187 view); 2187 view);
2188 Expect.throws(() { view[-1] = 0.0; }, 2188 Expect.throws(() { view[-1] = 0.0; },
2189 (e) { return e is IndexOutOfRangeException; }); 2189 (e) { return e is RangeError; });
2190 Expect.throws(() { return view[-1]; }, 2190 Expect.throws(() { return view[-1]; },
2191 (e) { return e is IndexOutOfRangeException; }); 2191 (e) { return e is RangeError; });
2192 Expect.throws(() { view[10]; }, 2192 Expect.throws(() { view[10]; },
2193 (e) { return e is IndexOutOfRangeException; }); 2193 (e) { return e is RangeError; });
2194 Expect.throws(() { view[10] = 0.0; }, 2194 Expect.throws(() { view[10] = 0.0; },
2195 (e) { return e is IndexOutOfRangeException; }); 2195 (e) { return e is RangeError; });
2196 Expect.throws(() { array.add(0.0); }, 2196 Expect.throws(() { array.add(0.0); },
2197 (e) { return e is UnsupportedError; }); 2197 (e) { return e is UnsupportedError; });
2198 Expect.throws(() { array.addAll([0]); }, 2198 Expect.throws(() { array.addAll([0]); },
2199 (e) { return e is UnsupportedError; }); 2199 (e) { return e is UnsupportedError; });
2200 Expect.throws(() { array.addLast(0.0); }, 2200 Expect.throws(() { array.addLast(0.0); },
2201 (e) { return e is UnsupportedError; }); 2201 (e) { return e is UnsupportedError; });
2202 Expect.throws(() { array.clear(); }, 2202 Expect.throws(() { array.clear(); },
2203 (e) { return e is UnsupportedError; }); 2203 (e) { return e is UnsupportedError; });
2204 Expect.throws(() { array.insertRange(0, array.length, 0.0); }, 2204 Expect.throws(() { array.insertRange(0, array.length, 0.0); },
2205 (e) { return e is UnsupportedError; }); 2205 (e) { return e is UnsupportedError; });
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 testInt64ListView(); 2269 testInt64ListView();
2270 testUint64ListView(); 2270 testUint64ListView();
2271 testFloat32ListView(); 2271 testFloat32ListView();
2272 testFloat64ListView(); 2272 testFloat64ListView();
2273 } 2273 }
2274 } 2274 }
2275 2275
2276 main() { 2276 main() {
2277 ByteArrayTest.testMain(); 2277 ByteArrayTest.testMain();
2278 } 2278 }
OLDNEW
« no previous file with comments | « runtime/lib/string_base.dart ('k') | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698