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

Side by Side Diff: test/typed_buffers_test.dart

Issue 1728943003: Fix TypedDataBuffer.insertAll() with an Iterable. (Closed) Base URL: git@github.com:dart-lang/typed_data@master
Patch Set: Created 4 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
« lib/typed_buffers.dart ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Tests typed-data buffer classes. 5 // Tests typed-data buffer classes.
6 6
7 import "dart:typed_data"; 7 import "dart:typed_data";
8 8
9 import "package:test/test.dart"; 9 import "package:test/test.dart";
10 import "package:typed_data/typed_buffers.dart"; 10 import "package:typed_data/typed_buffers.dart";
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 buffer.insertAll(0, source, 1, 4); 102 buffer.insertAll(0, source, 1, 4);
103 expect(buffer, equals([2, 3, 4, 6, 7, 8, 9, 10])); 103 expect(buffer, equals([2, 3, 4, 6, 7, 8, 9, 10]));
104 104
105 buffer.insertAll(3, source, 4); 105 buffer.insertAll(3, source, 4);
106 expect(buffer, equals([2, 3, 4, 5, 6, 7, 8, 9, 10])); 106 expect(buffer, equals([2, 3, 4, 5, 6, 7, 8, 9, 10]));
107 107
108 buffer.insertAll(5, source, 0, 1); 108 buffer.insertAll(5, source, 0, 1);
109 expect(buffer, equals([2, 3, 4, 5, 6, 1, 7, 8, 9, 10])); 109 expect(buffer, equals([2, 3, 4, 5, 6, 1, 7, 8, 9, 10]));
110 }); 110 });
111 111
112 // Regression test for #1.
113 test("inserts values into the buffer after removeRange()", () {
114 buffer.removeRange(1, 4);
115 buffer.insertAll(1, source);
116 expect(buffer, equals([6, 1, 2, 3, 4, 5, 10]));
117 });
118
112 test("does nothing for empty slices", () { 119 test("does nothing for empty slices", () {
113 buffer.insertAll(1, source, 0, 0); 120 buffer.insertAll(1, source, 0, 0);
114 expect(buffer, equals([6, 7, 8, 9, 10])); 121 expect(buffer, equals([6, 7, 8, 9, 10]));
115 122
116 buffer.insertAll(2, source, 3, 3); 123 buffer.insertAll(2, source, 3, 3);
117 expect(buffer, equals([6, 7, 8, 9, 10])); 124 expect(buffer, equals([6, 7, 8, 9, 10]));
118 125
119 buffer.insertAll(3, source, 5); 126 buffer.insertAll(3, source, 5);
120 expect(buffer, equals([6, 7, 8, 9, 10])); 127 expect(buffer, equals([6, 7, 8, 9, 10]));
121 128
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 bool matches(item, Map matchState) { 526 bool matches(item, Map matchState) {
520 if (item is! Int32x4) return false; 527 if (item is! Int32x4) return false;
521 Int32x4 value = item; 528 Int32x4 value = item;
522 return result.x == value.x && result.y == value.y && 529 return result.x == value.x && result.y == value.y &&
523 result.z == value.z && result.w == value.w; 530 result.z == value.z && result.w == value.w;
524 } 531 }
525 532
526 Description describe(Description description) => 533 Description describe(Description description) =>
527 description.add('Int32x4.=='); 534 description.add('Int32x4.==');
528 } 535 }
OLDNEW
« lib/typed_buffers.dart ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698