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

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

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
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 byte_array_test; 6 library byte_array_test;
7 7
8 import 'dart:scalarlist'; 8 import 'dart:scalarlist';
9 9
10 // This test exercises optimized [] and []= operators 10 // This test exercises optimized [] and []= operators
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 array); 68 array);
69 for (int i = 0; i < array.length; ++i) { 69 for (int i = 0; i < array.length; ++i) {
70 array[i] = -0x80 + i; 70 array[i] = -0x80 + i;
71 } 71 }
72 Expect.listEquals([-128, -127, -126, -125, -124, 72 Expect.listEquals([-128, -127, -126, -125, -124,
73 -123, -122, -121, -120, -119], 73 -123, -122, -121, -120, -119],
74 array); 74 array);
75 for (int i = 0; i < array.length; ++i) { 75 for (int i = 0; i < array.length; ++i) {
76 array[i] = i; 76 array[i] = i;
77 } 77 }
78 var copy = array.getRange(0, array.length); 78 var copy = array.sublist(0, array.length);
79 Expect.isFalse(copy === array); 79 Expect.isFalse(copy === array);
80 Expect.isTrue(copy is Int8List); 80 Expect.isTrue(copy is Int8List);
81 Expect.equals(10, copy.length); 81 Expect.equals(10, copy.length);
82 Expect.listEquals(array, copy); 82 Expect.listEquals(array, copy);
83 var empty = array.getRange(array.length, 0); 83 var empty = array.sublist(array.length, array.length);
84 Expect.equals(0, empty.length); 84 Expect.equals(0, empty.length);
85 var region = array.getRange(3, array.length - 6); 85 var region = array.sublist(3, array.length - 3);
86 Expect.isTrue(copy is Int8List); 86 Expect.isTrue(copy is Int8List);
87 Expect.equals(4, region.length); 87 Expect.equals(4, region.length);
88 Expect.listEquals([3, 4, 5, 6], region); 88 Expect.listEquals([3, 4, 5, 6], region);
89 array.setRange(3, 4, [-128, 0, 1, 127]); 89 array.setRange(3, 4, [-128, 0, 1, 127]);
90 Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9], 90 Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9],
91 array); 91 array);
92 } 92 }
93 static testInt8List() { 93 static testInt8List() {
94 Expect.throws(() { new Int8List(-1); }, 94 Expect.throws(() { new Int8List(-1); },
95 (e) { return e is ArgumentError; }); 95 (e) { return e is ArgumentError; });
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 array); 143 array);
144 for (int i = 0; i < array.length; ++i) { 144 for (int i = 0; i < array.length; ++i) {
145 array[i] = 0xFF - i; 145 array[i] = 0xFF - i;
146 } 146 }
147 Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 147 Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB,
148 0xFA, 0xF9, 0xF8, 0xF7, 0xF6], 148 0xFA, 0xF9, 0xF8, 0xF7, 0xF6],
149 array); 149 array);
150 for (int i = 0; i < array.length; ++i) { 150 for (int i = 0; i < array.length; ++i) {
151 array[i] = i; 151 array[i] = i;
152 } 152 }
153 var copy = array.getRange(0, array.length); 153 var copy = array.sublist(0, array.length);
154 Expect.isFalse(copy === array); 154 Expect.isFalse(copy === array);
155 Expect.isTrue(copy is Uint8List); 155 Expect.isTrue(copy is Uint8List);
156 Expect.equals(10, copy.length); 156 Expect.equals(10, copy.length);
157 Expect.listEquals(array, copy); 157 Expect.listEquals(array, copy);
158 var empty = array.getRange(array.length, 0); 158 var empty = array.sublist(array.length, array.length);
159 Expect.equals(0, empty.length); 159 Expect.equals(0, empty.length);
160 var region = array.getRange(3, array.length - 6); 160 var region = array.sublist(3, array.length - 3);
161 Expect.isTrue(copy is Uint8List); 161 Expect.isTrue(copy is Uint8List);
162 Expect.equals(4, region.length); 162 Expect.equals(4, region.length);
163 Expect.listEquals([3, 4, 5, 6], region); 163 Expect.listEquals([3, 4, 5, 6], region);
164 array.setRange(3, 4, [257, 0, 1, 255]); 164 array.setRange(3, 4, [257, 0, 1, 255]);
165 Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9], 165 Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9],
166 array); 166 array);
167 } 167 }
168 168
169 static testUint8List() { 169 static testUint8List() {
170 Expect.throws(() { new Uint8List(-1); }, 170 Expect.throws(() { new Uint8List(-1); },
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 array); 231 array);
232 for (int i = 0; i < array.length; ++i) { 232 for (int i = 0; i < array.length; ++i) {
233 array[i] = -0x8000 + i; 233 array[i] = -0x8000 + i;
234 } 234 }
235 Expect.listEquals([-0x8000, -0x7FFF, -0x7FFE, -0x7FFD, -0x7FFC, 235 Expect.listEquals([-0x8000, -0x7FFF, -0x7FFE, -0x7FFD, -0x7FFC,
236 -0x7FFB, -0x7FFA, -0x7FF9, -0x7FF8, -0x7FF7], 236 -0x7FFB, -0x7FFA, -0x7FF9, -0x7FF8, -0x7FF7],
237 array); 237 array);
238 for (int i = 0; i < array.length; ++i) { 238 for (int i = 0; i < array.length; ++i) {
239 array[i] = i; 239 array[i] = i;
240 } 240 }
241 var copy = array.getRange(0, array.length); 241 var copy = array.sublist(0, array.length);
242 Expect.isFalse(copy === array); 242 Expect.isFalse(copy === array);
243 Expect.isTrue(copy is Int16List); 243 Expect.isTrue(copy is Int16List);
244 Expect.equals(10, copy.length); 244 Expect.equals(10, copy.length);
245 Expect.listEquals(array, copy); 245 Expect.listEquals(array, copy);
246 var empty = array.getRange(array.length, 0); 246 var empty = array.sublist(array.length, array.length);
247 Expect.equals(0, empty.length); 247 Expect.equals(0, empty.length);
248 var region = array.getRange(3, array.length - 6); 248 var region = array.sublist(3, array.length - 3);
249 Expect.isTrue(copy is Int16List); 249 Expect.isTrue(copy is Int16List);
250 Expect.equals(4, region.length); 250 Expect.equals(4, region.length);
251 Expect.listEquals([3, 4, 5, 6], region); 251 Expect.listEquals([3, 4, 5, 6], region);
252 array.setRange(3, 4, [-32768, 0, 1, 32767]); 252 array.setRange(3, 4, [-32768, 0, 1, 32767]);
253 Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9], 253 Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9],
254 array); 254 array);
255 } 255 }
256 256
257 static testInt16List() { 257 static testInt16List() {
258 Expect.throws(() { new Int16List(-1); }, 258 Expect.throws(() { new Int16List(-1); },
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 array); 307 array);
308 for (int i = 0; i < array.length; ++i) { 308 for (int i = 0; i < array.length; ++i) {
309 array[i] = 0xFFFF - i; 309 array[i] = 0xFFFF - i;
310 } 310 }
311 Expect.listEquals([0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB, 311 Expect.listEquals([0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB,
312 0xFFFA, 0xFFF9, 0xFFF8, 0xFFF7, 0xFFF6], 312 0xFFFA, 0xFFF9, 0xFFF8, 0xFFF7, 0xFFF6],
313 array); 313 array);
314 for (int i = 0; i < array.length; ++i) { 314 for (int i = 0; i < array.length; ++i) {
315 array[i] = i; 315 array[i] = i;
316 } 316 }
317 var copy = array.getRange(0, array.length); 317 var copy = array.sublist(0, array.length);
318 Expect.isFalse(copy === array); 318 Expect.isFalse(copy === array);
319 Expect.isTrue(copy is Uint16List); 319 Expect.isTrue(copy is Uint16List);
320 Expect.equals(10, copy.length); 320 Expect.equals(10, copy.length);
321 Expect.listEquals(array, copy); 321 Expect.listEquals(array, copy);
322 var empty = array.getRange(array.length, 0); 322 var empty = array.sublist(array.length, array.length);
323 Expect.equals(0, empty.length); 323 Expect.equals(0, empty.length);
324 var region = array.getRange(3, array.length - 6); 324 var region = array.sublist(3, array.length - 3);
325 Expect.isTrue(copy is Uint16List); 325 Expect.isTrue(copy is Uint16List);
326 Expect.equals(4, region.length); 326 Expect.equals(4, region.length);
327 Expect.listEquals([3, 4, 5, 6], region); 327 Expect.listEquals([3, 4, 5, 6], region);
328 array.setRange(3, 4, [0x10001, 0, 1, 0xFFFF]); 328 array.setRange(3, 4, [0x10001, 0, 1, 0xFFFF]);
329 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9], 329 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9],
330 array); 330 array);
331 } 331 }
332 332
333 static testUint16List() { 333 static testUint16List() {
334 Expect.throws(() { new Uint16List(-1); }, 334 Expect.throws(() { new Uint16List(-1); },
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 401 }
402 Expect.listEquals([-0x80000000, -0x7FFFFFFF, 402 Expect.listEquals([-0x80000000, -0x7FFFFFFF,
403 -0x7FFFFFFE, -0x7FFFFFFD, 403 -0x7FFFFFFE, -0x7FFFFFFD,
404 -0x7FFFFFFC, -0x7FFFFFFB, 404 -0x7FFFFFFC, -0x7FFFFFFB,
405 -0x7FFFFFFA, -0x7FFFFFF9, 405 -0x7FFFFFFA, -0x7FFFFFF9,
406 -0x7FFFFFF8, -0x7FFFFFF7], 406 -0x7FFFFFF8, -0x7FFFFFF7],
407 array); 407 array);
408 for (int i = 0; i < array.length; ++i) { 408 for (int i = 0; i < array.length; ++i) {
409 array[i] = i; 409 array[i] = i;
410 } 410 }
411 var copy = array.getRange(0, array.length); 411 var copy = array.sublist(0, array.length);
412 Expect.isFalse(copy === array); 412 Expect.isFalse(copy === array);
413 Expect.isTrue(copy is Int32List); 413 Expect.isTrue(copy is Int32List);
414 Expect.equals(10, copy.length); 414 Expect.equals(10, copy.length);
415 Expect.listEquals(array, copy); 415 Expect.listEquals(array, copy);
416 var empty = array.getRange(array.length, 0); 416 var empty = array.sublist(array.length, array.length);
417 Expect.equals(0, empty.length); 417 Expect.equals(0, empty.length);
418 var region = array.getRange(3, array.length - 6); 418 var region = array.sublist(3, array.length - 3);
419 Expect.isTrue(copy is Int32List); 419 Expect.isTrue(copy is Int32List);
420 Expect.equals(4, region.length); 420 Expect.equals(4, region.length);
421 Expect.listEquals([3, 4, 5, 6], region); 421 Expect.listEquals([3, 4, 5, 6], region);
422 array.setRange(3, 4, [-0x80000000, 0, 1, 0x7FFFFFFF]); 422 array.setRange(3, 4, [-0x80000000, 0, 1, 0x7FFFFFFF]);
423 Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9], 423 Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9],
424 array); 424 array);
425 } 425 }
426 426
427 static testInt32List() { 427 static testInt32List() {
428 Expect.throws(() { new Int32List(-1); }, 428 Expect.throws(() { new Int32List(-1); },
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 480 }
481 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFE, 481 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFE,
482 0xFFFFFFFD, 0xFFFFFFFC, 482 0xFFFFFFFD, 0xFFFFFFFC,
483 0xFFFFFFFB, 0xFFFFFFFA, 483 0xFFFFFFFB, 0xFFFFFFFA,
484 0xFFFFFFF9, 0xFFFFFFF8, 484 0xFFFFFFF9, 0xFFFFFFF8,
485 0xFFFFFFF7, 0xFFFFFFF6], 485 0xFFFFFFF7, 0xFFFFFFF6],
486 array); 486 array);
487 for (int i = 0; i < array.length; ++i) { 487 for (int i = 0; i < array.length; ++i) {
488 array[i] = i; 488 array[i] = i;
489 } 489 }
490 var copy = array.getRange(0, array.length); 490 var copy = array.sublist(0, array.length);
491 Expect.isFalse(copy === array); 491 Expect.isFalse(copy === array);
492 Expect.isTrue(copy is Uint32List); 492 Expect.isTrue(copy is Uint32List);
493 Expect.equals(10, copy.length); 493 Expect.equals(10, copy.length);
494 Expect.listEquals(array, copy); 494 Expect.listEquals(array, copy);
495 var empty = array.getRange(array.length, 0); 495 var empty = array.sublist(array.length, array.length);
496 Expect.equals(0, empty.length); 496 Expect.equals(0, empty.length);
497 var region = array.getRange(3, array.length - 6); 497 var region = array.sublist(3, array.length - 3);
498 Expect.isTrue(copy is Uint32List); 498 Expect.isTrue(copy is Uint32List);
499 Expect.equals(4, region.length); 499 Expect.equals(4, region.length);
500 Expect.listEquals([3, 4, 5, 6], region); 500 Expect.listEquals([3, 4, 5, 6], region);
501 array.setRange(3, 4, [0x100000001, 0, 1, 0xFFFFFFFF]); 501 array.setRange(3, 4, [0x100000001, 0, 1, 0xFFFFFFFF]);
502 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9], 502 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9],
503 array); 503 array);
504 } 504 }
505 505
506 static testUint32List() { 506 static testUint32List() {
507 Expect.throws(() { new Uint32List(-1); }, 507 Expect.throws(() { new Uint32List(-1); },
508 (e) { return e is ArgumentError; }); 508 (e) { return e is ArgumentError; });
509 Expect.throws(() { new Uint32List(-1); }, 509 Expect.throws(() { new Uint32List(-1); },
510 (e) { return e is ArgumentError; }); 510 (e) { return e is ArgumentError; });
511 var array = new Uint32List(10); 511 var array = new Uint32List(10);
512 testUint32ListImpl(array); 512 testUint32ListImpl(array);
513 513
514 } 514 }
515 515
516 static testInt64ListImpl(Int64List array) { 516 static testInt64ListImpl(Int64List array) {
517 Expect.isTrue(array is List<int>); 517 Expect.isTrue(array is List<int>);
518 Expect.equals(10, array.length); 518 Expect.equals(10, array.length);
519 Expect.equals(8, array.bytesPerElement()); 519 Expect.equals(8, array.bytesPerElement());
520 Expect.equals(80, array.lengthInBytes()); 520 Expect.equals(80, array.lengthInBytes());
521 Expect.listEquals([0, 0, 0, 0, 0, 521 Expect.listEquals([0, 0, 0, 0, 0,
522 0, 0, 0, 0, 0], 522 0, 0, 0, 0, 0],
523 array); 523 array);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 577 }
578 Expect.listEquals([-0x8000000000000000, -0x7FFFFFFFFFFFFFFF, 578 Expect.listEquals([-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
579 -0x7FFFFFFFFFFFFFFE, -0x7FFFFFFFFFFFFFFD, 579 -0x7FFFFFFFFFFFFFFE, -0x7FFFFFFFFFFFFFFD,
580 -0x7FFFFFFFFFFFFFFC, -0x7FFFFFFFFFFFFFFB, 580 -0x7FFFFFFFFFFFFFFC, -0x7FFFFFFFFFFFFFFB,
581 -0x7FFFFFFFFFFFFFFA, -0x7FFFFFFFFFFFFFF9, 581 -0x7FFFFFFFFFFFFFFA, -0x7FFFFFFFFFFFFFF9,
582 -0x7FFFFFFFFFFFFFF8, -0x7FFFFFFFFFFFFFF7], 582 -0x7FFFFFFFFFFFFFF8, -0x7FFFFFFFFFFFFFF7],
583 array); 583 array);
584 for (int i = 0; i < array.length; ++i) { 584 for (int i = 0; i < array.length; ++i) {
585 array[i] = i; 585 array[i] = i;
586 } 586 }
587 var copy = array.getRange(0, array.length); 587 var copy = array.sublist(0, array.length);
588 Expect.isFalse(copy === array); 588 Expect.isFalse(copy === array);
589 Expect.isTrue(copy is Int64List); 589 Expect.isTrue(copy is Int64List);
590 Expect.equals(10, copy.length); 590 Expect.equals(10, copy.length);
591 Expect.listEquals(array, copy); 591 Expect.listEquals(array, copy);
592 var empty = array.getRange(array.length, 0); 592 var empty = array.sublist(array.length, array.length);
593 Expect.equals(0, empty.length); 593 Expect.equals(0, empty.length);
594 var region = array.getRange(3, array.length - 6); 594 var region = array.sublist(3, array.length - 3);
595 Expect.isTrue(copy is Int64List); 595 Expect.isTrue(copy is Int64List);
596 Expect.equals(4, region.length); 596 Expect.equals(4, region.length);
597 Expect.listEquals([3, 4, 5, 6], region); 597 Expect.listEquals([3, 4, 5, 6], region);
598 array.setRange(3, 4, [-0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF]); 598 array.setRange(3, 4, [-0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF]);
599 Expect.listEquals([0, 1, 2, -0x8000000000000000, 0, 599 Expect.listEquals([0, 1, 2, -0x8000000000000000, 0,
600 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9], 600 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9],
601 array); 601 array);
602 } 602 }
603 603
604 static testInt64List() { 604 static testInt64List() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 657 }
658 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFE, 658 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFE,
659 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFC, 659 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFC,
660 0xFFFFFFFFFFFFFFFB, 0xFFFFFFFFFFFFFFFA, 660 0xFFFFFFFFFFFFFFFB, 0xFFFFFFFFFFFFFFFA,
661 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFF8, 661 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFF8,
662 0xFFFFFFFFFFFFFFF7, 0xFFFFFFFFFFFFFFF6], 662 0xFFFFFFFFFFFFFFF7, 0xFFFFFFFFFFFFFFF6],
663 array); 663 array);
664 for (int i = 0; i < array.length; ++i) { 664 for (int i = 0; i < array.length; ++i) {
665 array[i] = i; 665 array[i] = i;
666 } 666 }
667 var copy = array.getRange(0, array.length); 667 var copy = array.sublist(0, array.length);
668 Expect.isFalse(copy === array); 668 Expect.isFalse(copy === array);
669 Expect.isTrue(copy is Uint64List); 669 Expect.isTrue(copy is Uint64List);
670 Expect.equals(10, copy.length); 670 Expect.equals(10, copy.length);
671 Expect.listEquals(array, copy); 671 Expect.listEquals(array, copy);
672 var empty = array.getRange(array.length, 0); 672 var empty = array.sublist(array.length, array.length);
673 Expect.equals(0, empty.length); 673 Expect.equals(0, empty.length);
674 var region = array.getRange(3, array.length - 6); 674 var region = array.sublist(3, array.length - 3);
675 Expect.isTrue(copy is Uint64List); 675 Expect.isTrue(copy is Uint64List);
676 Expect.equals(4, region.length); 676 Expect.equals(4, region.length);
677 Expect.listEquals([3, 4, 5, 6], region); 677 Expect.listEquals([3, 4, 5, 6], region);
678 array.setRange(3, 4, [0x10000000000000001, 0, 1, 0xFFFFFFFFFFFFFFFF]); 678 array.setRange(3, 4, [0x10000000000000001, 0, 1, 0xFFFFFFFFFFFFFFFF]);
679 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9], 679 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9],
680 array); 680 array);
681 } 681 }
682 682
683 static testUint64List() { 683 static testUint64List() {
684 Expect.throws(() { new Uint64List(-1); }, 684 Expect.throws(() { new Uint64List(-1); },
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 for (int i = 0; i < array.length; ++i) { 722 for (int i = 0; i < array.length; ++i) {
723 array[i] = 1.0 + i; 723 array[i] = 1.0 + i;
724 } 724 }
725 Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0, 725 Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0,
726 6.0, 7.0, 8.0, 9.0, 10.0], 726 6.0, 7.0, 8.0, 9.0, 10.0],
727 array); 727 array);
728 // TODO: min, max, and round 728 // TODO: min, max, and round
729 for (int i = 0; i < array.length; ++i) { 729 for (int i = 0; i < array.length; ++i) {
730 array[i] = i * 1.0; 730 array[i] = i * 1.0;
731 } 731 }
732 var copy = array.getRange(0, array.length); 732 var copy = array.sublist(0, array.length);
733 Expect.isFalse(copy === array); 733 Expect.isFalse(copy === array);
734 Expect.isTrue(copy is Float32List); 734 Expect.isTrue(copy is Float32List);
735 Expect.equals(10, copy.length); 735 Expect.equals(10, copy.length);
736 Expect.listEquals(array, copy); 736 Expect.listEquals(array, copy);
737 var empty = array.getRange(array.length, 0); 737 var empty = array.sublist(array.length, array.length);
738 Expect.equals(0, empty.length); 738 Expect.equals(0, empty.length);
739 var region = array.getRange(3, array.length - 6); 739 var region = array.sublist(3, array.length - 3);
740 Expect.isTrue(copy is Float32List); 740 Expect.isTrue(copy is Float32List);
741 Expect.equals(4, region.length); 741 Expect.equals(4, region.length);
742 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region); 742 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
743 array.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]); 743 array.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
744 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0, 744 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
745 1.0, double.INFINITY, 7.0, 8.0, 9.0], 745 1.0, double.INFINITY, 7.0, 8.0, 9.0],
746 array); 746 array);
747 } 747 }
748 748
749 static testFloat32List() { 749 static testFloat32List() {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 for (int i = 0; i < array.length; ++i) { 788 for (int i = 0; i < array.length; ++i) {
789 array[i] = 1.0 + i; 789 array[i] = 1.0 + i;
790 } 790 }
791 Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0, 791 Expect.listEquals([1.0, 2.0, 3.0, 4.0, 5.0,
792 6.0, 7.0, 8.0, 9.0, 10.0], 792 6.0, 7.0, 8.0, 9.0, 10.0],
793 array); 793 array);
794 // TODO: min, max 794 // TODO: min, max
795 for (int i = 0; i < array.length; ++i) { 795 for (int i = 0; i < array.length; ++i) {
796 array[i] = i * 1.0; 796 array[i] = i * 1.0;
797 } 797 }
798 var copy = array.getRange(0, array.length); 798 var copy = array.sublist(0, array.length);
799 Expect.isFalse(copy === array); 799 Expect.isFalse(copy === array);
800 Expect.isTrue(copy is Float64List); 800 Expect.isTrue(copy is Float64List);
801 Expect.equals(10, copy.length); 801 Expect.equals(10, copy.length);
802 Expect.listEquals(array, copy); 802 Expect.listEquals(array, copy);
803 var empty = array.getRange(array.length, 0); 803 var empty = array.sublist(array.length, array.length);
804 Expect.equals(0, empty.length); 804 Expect.equals(0, empty.length);
805 var region = array.getRange(3, array.length - 6); 805 var region = array.sublist(3, array.length - 3);
806 Expect.isTrue(copy is Float64List); 806 Expect.isTrue(copy is Float64List);
807 Expect.equals(4, region.length); 807 Expect.equals(4, region.length);
808 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region); 808 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
809 array.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]); 809 array.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
810 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0, 810 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
811 1.0, double.INFINITY, 7.0, 8.0, 9.0], 811 1.0, double.INFINITY, 7.0, 8.0, 9.0],
812 array); 812 array);
813 } 813 }
814 814
815 static testFloat64List() { 815 static testFloat64List() {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } 922 }
923 Expect.listEquals([-128, -127, -126, -125, -124, 923 Expect.listEquals([-128, -127, -126, -125, -124,
924 -123, -122, -121, -120, -119], 924 -123, -122, -121, -120, -119],
925 view); 925 view);
926 Expect.listEquals([0xFF, 0x80, 0x81, 0x82, 0x83, 0x84, 926 Expect.listEquals([0xFF, 0x80, 0x81, 0x82, 0x83, 0x84,
927 0x85, 0x86, 0x87, 0x88, 0x89, 0xFF], 927 0x85, 0x86, 0x87, 0x88, 0x89, 0xFF],
928 array); 928 array);
929 for (int i = 0; i < view.length; ++i) { 929 for (int i = 0; i < view.length; ++i) {
930 view[i] = i; 930 view[i] = i;
931 } 931 }
932 var copy = view.getRange(0, view.length); 932 var copy = view.sublist(0, view.length);
933 Expect.isFalse(copy === view); 933 Expect.isFalse(copy === view);
934 Expect.isTrue(copy is Int8List); 934 Expect.isTrue(copy is Int8List);
935 Expect.equals(10, copy.length); 935 Expect.equals(10, copy.length);
936 Expect.listEquals(view, copy); 936 Expect.listEquals(view, copy);
937 var region = view.getRange(3, view.length - 6); 937 var region = view.sublist(3, view.length - 3);
938 Expect.isTrue(copy is Int8List); 938 Expect.isTrue(copy is Int8List);
939 Expect.equals(4, region.length); 939 Expect.equals(4, region.length);
940 Expect.listEquals([3, 4, 5, 6], region); 940 Expect.listEquals([3, 4, 5, 6], region);
941 view.setRange(3, 4, [-128, 0, 1, 127]); 941 view.setRange(3, 4, [-128, 0, 1, 127]);
942 Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9], 942 Expect.listEquals([0, 1, 2, -128, 0, 1, 127, 7, 8, 9],
943 view); 943 view);
944 Expect.listEquals([0xFF, 0, 1, 2, 128, 0, 1, 127, 7, 8, 9, 0xFF], 944 Expect.listEquals([0xFF, 0, 1, 2, 128, 0, 1, 127, 7, 8, 9, 0xFF],
945 array); 945 array);
946 } 946 }
947 static testInt8ListView() { 947 static testInt8ListView() {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 } 1035 }
1036 Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 1036 Expect.listEquals([0xFF, 0xFE, 0xFD, 0xFC, 0xFB,
1037 0xFA, 0xF9, 0xF8, 0xF7, 0xF6], 1037 0xFA, 0xF9, 0xF8, 0xF7, 0xF6],
1038 view); 1038 view);
1039 Expect.listEquals([-1, -1, -2, -3, -4, -5, 1039 Expect.listEquals([-1, -1, -2, -3, -4, -5,
1040 -6, -7, -8, -9, -10, -1], 1040 -6, -7, -8, -9, -10, -1],
1041 array); 1041 array);
1042 for (int i = 0; i < view.length; ++i) { 1042 for (int i = 0; i < view.length; ++i) {
1043 view[i] = i; 1043 view[i] = i;
1044 } 1044 }
1045 var copy = view.getRange(0, view.length); 1045 var copy = view.sublist(0, view.length);
1046 Expect.isFalse(copy === view); 1046 Expect.isFalse(copy === view);
1047 Expect.isTrue(copy is Uint8List); 1047 Expect.isTrue(copy is Uint8List);
1048 Expect.equals(10, copy.length); 1048 Expect.equals(10, copy.length);
1049 Expect.listEquals(view, copy); 1049 Expect.listEquals(view, copy);
1050 var region = view.getRange(3, view.length - 6); 1050 var region = view.sublist(3, view.length - 3);
1051 Expect.isTrue(copy is Uint8List); 1051 Expect.isTrue(copy is Uint8List);
1052 Expect.equals(4, region.length); 1052 Expect.equals(4, region.length);
1053 Expect.listEquals([3, 4, 5, 6], region); 1053 Expect.listEquals([3, 4, 5, 6], region);
1054 view.setRange(3, 4, [257, 0, 1, 255]); 1054 view.setRange(3, 4, [257, 0, 1, 255]);
1055 Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9], 1055 Expect.listEquals([0, 1, 2, 1, 0, 1, 255, 7, 8, 9],
1056 view); 1056 view);
1057 } 1057 }
1058 1058
1059 static testUint8ListView() { 1059 static testUint8ListView() {
1060 var array = new Int8List(12); 1060 var array = new Int8List(12);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 Expect.listEquals([-0x8000, -0x7FFF, -0x7FFE, -0x7FFD, -0x7FFC, 1169 Expect.listEquals([-0x8000, -0x7FFF, -0x7FFE, -0x7FFD, -0x7FFC,
1170 -0x7FFB, -0x7FFA, -0x7FF9, -0x7FF8, -0x7FF7], 1170 -0x7FFB, -0x7FFA, -0x7FF9, -0x7FF8, -0x7FF7],
1171 view); 1171 view);
1172 Expect.listEquals([0xFF, 0xFF, 0x00, 0x80, 0x01, 0x80, 0x02, 0x80, 1172 Expect.listEquals([0xFF, 0xFF, 0x00, 0x80, 0x01, 0x80, 0x02, 0x80,
1173 0x03, 0x80, 0x04, 0x80, 0x05, 0x80, 0x06, 0x80, 1173 0x03, 0x80, 0x04, 0x80, 0x05, 0x80, 0x06, 0x80,
1174 0x07, 0x80, 0x08, 0x80, 0x09, 0x80, 0xFF, 0xFF], 1174 0x07, 0x80, 0x08, 0x80, 0x09, 0x80, 0xFF, 0xFF],
1175 array); 1175 array);
1176 for (int i = 0; i < view.length; ++i) { 1176 for (int i = 0; i < view.length; ++i) {
1177 view[i] = i; 1177 view[i] = i;
1178 } 1178 }
1179 var copy = view.getRange(0, view.length); 1179 var copy = view.sublist(0, view.length);
1180 Expect.isFalse(copy === view); 1180 Expect.isFalse(copy === view);
1181 Expect.isTrue(copy is Int16List); 1181 Expect.isTrue(copy is Int16List);
1182 Expect.equals(10, copy.length); 1182 Expect.equals(10, copy.length);
1183 Expect.listEquals(view, copy); 1183 Expect.listEquals(view, copy);
1184 var region = view.getRange(3, view.length - 6); 1184 var region = view.sublist(3, view.length - 3);
1185 Expect.isTrue(copy is Int16List); 1185 Expect.isTrue(copy is Int16List);
1186 Expect.equals(4, region.length); 1186 Expect.equals(4, region.length);
1187 Expect.listEquals([3, 4, 5, 6], region); 1187 Expect.listEquals([3, 4, 5, 6], region);
1188 view.setRange(3, 4, [-32768, 0, 1, 32767]); 1188 view.setRange(3, 4, [-32768, 0, 1, 32767]);
1189 Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9], 1189 Expect.listEquals([0, 1, 2, -32768, 0, 1, 32767, 7, 8, 9],
1190 view); 1190 view);
1191 Expect.listEquals([0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 1191 Expect.listEquals([0xFF, 0xFF, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
1192 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0xFF, 0x7F, 1192 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0xFF, 0x7F,
1193 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0xFF, 0xFF], 1193 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0xFF, 0xFF],
1194 array); 1194 array);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 Expect.listEquals([0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB, 1286 Expect.listEquals([0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB,
1287 0xFFFA, 0xFFF9, 0xFFF8, 0xFFF7, 0xFFF6], 1287 0xFFFA, 0xFFF9, 0xFFF8, 0xFFF7, 0xFFF6],
1288 view); 1288 view);
1289 Expect.listEquals([-1, -1, -1, -1, -2, -1, -3, -1, 1289 Expect.listEquals([-1, -1, -1, -1, -2, -1, -3, -1,
1290 -4, -1, -5, -1, -6, -1, -7, -1, 1290 -4, -1, -5, -1, -6, -1, -7, -1,
1291 -8, -1, -9, -1, -10, -1, -1, -1], 1291 -8, -1, -9, -1, -10, -1, -1, -1],
1292 array); 1292 array);
1293 for (int i = 0; i < view.length; ++i) { 1293 for (int i = 0; i < view.length; ++i) {
1294 view[i] = i; 1294 view[i] = i;
1295 } 1295 }
1296 var copy = view.getRange(0, view.length); 1296 var copy = view.sublist(0, view.length);
1297 Expect.isFalse(copy === view); 1297 Expect.isFalse(copy === view);
1298 Expect.isTrue(copy is Uint16List); 1298 Expect.isTrue(copy is Uint16List);
1299 Expect.equals(10, copy.length); 1299 Expect.equals(10, copy.length);
1300 Expect.listEquals(view, copy); 1300 Expect.listEquals(view, copy);
1301 var region = view.getRange(3, view.length - 6); 1301 var region = view.sublist(3, view.length - 3);
1302 Expect.isTrue(copy is Uint16List); 1302 Expect.isTrue(copy is Uint16List);
1303 Expect.equals(4, region.length); 1303 Expect.equals(4, region.length);
1304 Expect.listEquals([3, 4, 5, 6], region); 1304 Expect.listEquals([3, 4, 5, 6], region);
1305 view.setRange(3, 4, [0x10001, 0, 1, 0xFFFF]); 1305 view.setRange(3, 4, [0x10001, 0, 1, 0xFFFF]);
1306 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9], 1306 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFF, 7, 8, 9],
1307 view); 1307 view);
1308 Expect.listEquals([-1, -1, 0, 0, 1, 0, 2, 0, 1308 Expect.listEquals([-1, -1, 0, 0, 1, 0, 2, 0,
1309 1, 0, 0, 0, 1, 0, -1, -1, 1309 1, 0, 0, 0, 1, 0, -1, -1,
1310 7, 0, 8, 0, 9, 0, -1, -1], 1310 7, 0, 8, 0, 9, 0, -1, -1],
1311 array); 1311 array);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x80, 1446 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x80,
1447 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 1447 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80,
1448 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, 1448 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80,
1449 0x05, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x80, 1449 0x05, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x80,
1450 0x07, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x80, 1450 0x07, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x80,
1451 0x09, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF], 1451 0x09, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF],
1452 array); 1452 array);
1453 for (int i = 0; i < view.length; ++i) { 1453 for (int i = 0; i < view.length; ++i) {
1454 view[i] = i; 1454 view[i] = i;
1455 } 1455 }
1456 var copy = view.getRange(0, view.length); 1456 var copy = view.sublist(0, view.length);
1457 Expect.isFalse(copy === view); 1457 Expect.isFalse(copy === view);
1458 Expect.isTrue(copy is Int32List); 1458 Expect.isTrue(copy is Int32List);
1459 Expect.equals(10, copy.length); 1459 Expect.equals(10, copy.length);
1460 Expect.listEquals(view, copy); 1460 Expect.listEquals(view, copy);
1461 var region = view.getRange(3, view.length - 6); 1461 var region = view.sublist(3, view.length - 3);
1462 Expect.isTrue(copy is Int32List); 1462 Expect.isTrue(copy is Int32List);
1463 Expect.equals(4, region.length); 1463 Expect.equals(4, region.length);
1464 Expect.listEquals([3, 4, 5, 6], region); 1464 Expect.listEquals([3, 4, 5, 6], region);
1465 view.setRange(3, 4, [-0x80000000, 0, 1, 0x7FFFFFFF]); 1465 view.setRange(3, 4, [-0x80000000, 0, 1, 0x7FFFFFFF]);
1466 Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9], 1466 Expect.listEquals([0, 1, 2, -0x80000000, 0, 1, 0x7FFFFFFF, 7, 8, 9],
1467 view); 1467 view);
1468 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 1468 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
1469 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 1469 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1470 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 1470 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
1471 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 1471 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x7F,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1, 1575 Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1,
1576 -2, -1, -1, -1, -3, -1, -1, -1, 1576 -2, -1, -1, -1, -3, -1, -1, -1,
1577 -4, -1, -1, -1, -5, -1, -1, -1, 1577 -4, -1, -1, -1, -5, -1, -1, -1,
1578 -6, -1, -1, -1, -7, -1, -1, -1, 1578 -6, -1, -1, -1, -7, -1, -1, -1,
1579 -8, -1, -1, -1, -9, -1, -1, -1, 1579 -8, -1, -1, -1, -9, -1, -1, -1,
1580 -10, -1, -1, -1, -1, -1, -1, -1], 1580 -10, -1, -1, -1, -1, -1, -1, -1],
1581 array); 1581 array);
1582 for (int i = 0; i < view.length; ++i) { 1582 for (int i = 0; i < view.length; ++i) {
1583 view[i] = i; 1583 view[i] = i;
1584 } 1584 }
1585 var copy = view.getRange(0, view.length); 1585 var copy = view.sublist(0, view.length);
1586 Expect.isFalse(copy === view); 1586 Expect.isFalse(copy === view);
1587 Expect.isTrue(copy is Uint32List); 1587 Expect.isTrue(copy is Uint32List);
1588 Expect.equals(10, copy.length); 1588 Expect.equals(10, copy.length);
1589 Expect.listEquals(view, copy); 1589 Expect.listEquals(view, copy);
1590 var region = view.getRange(3, view.length - 6); 1590 var region = view.sublist(3, view.length - 3);
1591 Expect.isTrue(copy is Uint32List); 1591 Expect.isTrue(copy is Uint32List);
1592 Expect.equals(4, region.length); 1592 Expect.equals(4, region.length);
1593 Expect.listEquals([3, 4, 5, 6], region); 1593 Expect.listEquals([3, 4, 5, 6], region);
1594 view.setRange(3, 4, [0x100000001, 0, 1, 0xFFFFFFFF]); 1594 view.setRange(3, 4, [0x100000001, 0, 1, 0xFFFFFFFF]);
1595 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9], 1595 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFF, 7, 8, 9],
1596 view); 1596 view);
1597 Expect.listEquals([-1, -1, -1, -1, 0, 0, 0, 0, 1597 Expect.listEquals([-1, -1, -1, -1, 0, 0, 0, 0,
1598 1, 0, 0, 0, 2, 0, 0, 0, 1598 1, 0, 0, 0, 2, 0, 0, 0,
1599 1, 0, 0, 0, 0, 0, 0, 0, 1599 1, 0, 0, 0, 0, 0, 0, 0,
1600 1, 0, 0, 0, -1, -1, -1, -1, 1600 1, 0, 0, 0, -1, -1, -1, -1,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 1767 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1768 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 1768 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1769 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 1769 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1770 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 1770 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1771 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 1771 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1772 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], 1772 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
1773 array); 1773 array);
1774 for (int i = 0; i < view.length; ++i) { 1774 for (int i = 0; i < view.length; ++i) {
1775 view[i] = i; 1775 view[i] = i;
1776 } 1776 }
1777 var copy = view.getRange(0, view.length); 1777 var copy = view.sublist(0, view.length);
1778 Expect.isFalse(copy === view); 1778 Expect.isFalse(copy === view);
1779 Expect.isTrue(copy is Int64List); 1779 Expect.isTrue(copy is Int64List);
1780 Expect.equals(10, copy.length); 1780 Expect.equals(10, copy.length);
1781 Expect.listEquals(view, copy); 1781 Expect.listEquals(view, copy);
1782 var region = view.getRange(3, view.length - 6); 1782 var region = view.sublist(3, view.length - 3);
1783 Expect.isTrue(copy is Int64List); 1783 Expect.isTrue(copy is Int64List);
1784 Expect.equals(4, region.length); 1784 Expect.equals(4, region.length);
1785 Expect.listEquals([3, 4, 5, 6], region); 1785 Expect.listEquals([3, 4, 5, 6], region);
1786 view.setRange(3, 4, [-0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF]); 1786 view.setRange(3, 4, [-0x8000000000000000, 0, 1, 0x7FFFFFFFFFFFFFFF]);
1787 Expect.listEquals([0, 1, 2, -0x8000000000000000, 0, 1787 Expect.listEquals([0, 1, 2, -0x8000000000000000, 0,
1788 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9], 1788 1, 0x7FFFFFFFFFFFFFFF, 7, 8, 9],
1789 view); 1789 view);
1790 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1790 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1791 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1792 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1792 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 -6, -1, -1, -1, -1, -1, -1, -1, 1929 -6, -1, -1, -1, -1, -1, -1, -1,
1930 -7, -1, -1, -1, -1, -1, -1, -1, 1930 -7, -1, -1, -1, -1, -1, -1, -1,
1931 -8, -1, -1, -1, -1, -1, -1, -1, 1931 -8, -1, -1, -1, -1, -1, -1, -1,
1932 -9, -1, -1, -1, -1, -1, -1, -1, 1932 -9, -1, -1, -1, -1, -1, -1, -1,
1933 -10, -1, -1, -1, -1, -1, -1, -1, 1933 -10, -1, -1, -1, -1, -1, -1, -1,
1934 -1, -1, -1, -1, -1, -1, -1, -1], 1934 -1, -1, -1, -1, -1, -1, -1, -1],
1935 array); 1935 array);
1936 for (int i = 0; i < view.length; ++i) { 1936 for (int i = 0; i < view.length; ++i) {
1937 view[i] = i; 1937 view[i] = i;
1938 } 1938 }
1939 var copy = view.getRange(0, view.length); 1939 var copy = view.sublist(0, view.length);
1940 Expect.isFalse(copy === view); 1940 Expect.isFalse(copy === view);
1941 Expect.isTrue(copy is Uint64List); 1941 Expect.isTrue(copy is Uint64List);
1942 Expect.equals(10, copy.length); 1942 Expect.equals(10, copy.length);
1943 Expect.listEquals(view, copy); 1943 Expect.listEquals(view, copy);
1944 var region = view.getRange(3, view.length - 6); 1944 var region = view.sublist(3, view.length - 3);
1945 Expect.isTrue(copy is Uint64List); 1945 Expect.isTrue(copy is Uint64List);
1946 Expect.equals(4, region.length); 1946 Expect.equals(4, region.length);
1947 Expect.listEquals([3, 4, 5, 6], region); 1947 Expect.listEquals([3, 4, 5, 6], region);
1948 view.setRange(3, 4, [0x10000000000000001, 0, 1, 0xFFFFFFFFFFFFFFFF]); 1948 view.setRange(3, 4, [0x10000000000000001, 0, 1, 0xFFFFFFFFFFFFFFFF]);
1949 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9], 1949 Expect.listEquals([0, 1, 2, 1, 0, 1, 0xFFFFFFFFFFFFFFFF, 7, 8, 9],
1950 view); 1950 view);
1951 Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1, 1951 Expect.listEquals([-1, -1, -1, -1, -1, -1, -1, -1,
1952 0, 0, 0, 0, 0, 0, 0, 0, 1952 0, 0, 0, 0, 0, 0, 0, 0,
1953 1, 0, 0, 0, 0, 0, 0, 0, 1953 1, 0, 0, 0, 0, 0, 0, 0,
1954 2, 0, 0, 0, 0, 0, 0, 0, 1954 2, 0, 0, 0, 0, 0, 0, 0,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 0x40000000, 0x40400000, 2041 0x40000000, 0x40400000,
2042 0x40800000, 0x40A00000, 2042 0x40800000, 0x40A00000,
2043 0x40C00000, 0x40E00000, 2043 0x40C00000, 0x40E00000,
2044 0x41000000, 0x41100000, 2044 0x41000000, 0x41100000,
2045 0x41200000, 0xBF800000], 2045 0x41200000, 0xBF800000],
2046 array); 2046 array);
2047 // TODO: min, max, and round 2047 // TODO: min, max, and round
2048 for (int i = 0; i < view.length; ++i) { 2048 for (int i = 0; i < view.length; ++i) {
2049 view[i] = i * 1.0; 2049 view[i] = i * 1.0;
2050 } 2050 }
2051 var copy = view.getRange(0, view.length); 2051 var copy = view.sublist(0, view.length);
2052 Expect.isFalse(copy === view); 2052 Expect.isFalse(copy === view);
2053 Expect.isTrue(copy is Float32List); 2053 Expect.isTrue(copy is Float32List);
2054 Expect.equals(10, copy.length); 2054 Expect.equals(10, copy.length);
2055 Expect.listEquals(view, copy); 2055 Expect.listEquals(view, copy);
2056 var region = view.getRange(3, view.length - 6); 2056 var region = view.sublist(3, view.length - 3);
2057 Expect.isTrue(copy is Float32List); 2057 Expect.isTrue(copy is Float32List);
2058 Expect.equals(4, region.length); 2058 Expect.equals(4, region.length);
2059 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region); 2059 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
2060 view.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]); 2060 view.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
2061 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0, 2061 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
2062 1.0, double.INFINITY, 7.0, 8.0, 9.0], 2062 1.0, double.INFINITY, 7.0, 8.0, 9.0],
2063 view); 2063 view);
2064 Expect.listEquals([0xBF800000, 0x00000000, 2064 Expect.listEquals([0xBF800000, 0x00000000,
2065 0x3F800000, 0x40000000, 2065 0x3F800000, 0x40000000,
2066 0xFF800000, 0x00000000, 2066 0xFF800000, 0x00000000,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 0x4000000000000000, 0x4008000000000000, 2148 0x4000000000000000, 0x4008000000000000,
2149 0x4010000000000000, 0x4014000000000000, 2149 0x4010000000000000, 0x4014000000000000,
2150 0x4018000000000000, 0x401C000000000000, 2150 0x4018000000000000, 0x401C000000000000,
2151 0x4020000000000000, 0x4022000000000000, 2151 0x4020000000000000, 0x4022000000000000,
2152 0x4024000000000000, 0xBFF0000000000000], 2152 0x4024000000000000, 0xBFF0000000000000],
2153 array); 2153 array);
2154 // TODO: min, max 2154 // TODO: min, max
2155 for (int i = 0; i < view.length; ++i) { 2155 for (int i = 0; i < view.length; ++i) {
2156 view[i] = i * 1.0; 2156 view[i] = i * 1.0;
2157 } 2157 }
2158 var copy = view.getRange(0, view.length); 2158 var copy = view.sublist(0, view.length);
2159 Expect.isFalse(copy === view); 2159 Expect.isFalse(copy === view);
2160 Expect.isTrue(copy is Float64List); 2160 Expect.isTrue(copy is Float64List);
2161 Expect.equals(10, copy.length); 2161 Expect.equals(10, copy.length);
2162 Expect.listEquals(view, copy); 2162 Expect.listEquals(view, copy);
2163 var region = view.getRange(3, view.length - 6); 2163 var region = view.sublist(3, view.length - 3);
2164 Expect.isTrue(copy is Float64List); 2164 Expect.isTrue(copy is Float64List);
2165 Expect.equals(4, region.length); 2165 Expect.equals(4, region.length);
2166 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region); 2166 Expect.listEquals([3.0, 4.0, 5.0, 6.0], region);
2167 view.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]); 2167 view.setRange(3, 4, [double.NEGATIVE_INFINITY, 0.0, 1.0, double.INFINITY]);
2168 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0, 2168 Expect.listEquals([0.0, 1.0, 2.0, double.NEGATIVE_INFINITY, 0.0,
2169 1.0, double.INFINITY, 7.0, 8.0, 9.0], 2169 1.0, double.INFINITY, 7.0, 8.0, 9.0],
2170 view); 2170 view);
2171 Expect.listEquals([0xBFF0000000000000, 0x0000000000000000, 2171 Expect.listEquals([0xBFF0000000000000, 0x0000000000000000,
2172 0x3FF0000000000000, 0x4000000000000000, 2172 0x3FF0000000000000, 0x4000000000000000,
2173 0xFFF0000000000000, 0x0000000000000000, 2173 0xFFF0000000000000, 0x0000000000000000,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 testFloat32ListView(); 2205 testFloat32ListView();
2206 testFloat64ListView(); 2206 testFloat64ListView();
2207 } 2207 }
2208 } 2208 }
2209 2209
2210 main() { 2210 main() {
2211 for (var i=0; i<1000; i++) { 2211 for (var i=0; i<1000; i++) {
2212 OptimizedByteArrayTest.testMain(); 2212 OptimizedByteArrayTest.testMain();
2213 } 2213 }
2214 } 2214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698