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

Side by Side Diff: tests/standalone/typed_data_test.dart

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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) 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 // Dart test program for testing typed data. 5 // Dart test program for testing typed data.
6 6
7 // Library tag to be able to run in html test framework. 7 // Library tag to be able to run in html test framework.
8 library TypedDataTest; 8 library TypedDataTest;
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 typed_data[0] = 20; 156 typed_data[0] = 20;
157 typed_data[1] = 21; 157 typed_data[1] = 21;
158 typed_data[2] = 22; 158 typed_data[2] = 22;
159 list.setRange(0, 3, typed_data); 159 list.setRange(0, 3, typed_data);
160 for (int i = 0; i < 3; i++) { 160 for (int i = 0; i < 3; i++) {
161 Expect.equals(20 + i, list[i]); 161 Expect.equals(20 + i, list[i]);
162 } 162 }
163 163
164 typed_data.setRange(1, 2, const [8, 9]); 164 typed_data.setRange(1, 3, const [8, 9]);
165 Expect.equals(20, typed_data[0]); 165 Expect.equals(20, typed_data[0]);
166 Expect.equals(8, typed_data[1]); 166 Expect.equals(8, typed_data[1]);
167 Expect.equals(9, typed_data[2]); 167 Expect.equals(9, typed_data[2]);
168 } 168 }
169 169
170 void testSetRange() { 170 void testSetRange() {
171 testSetRangeHelper(new Uint8List(3)); 171 testSetRangeHelper(new Uint8List(3));
172 testSetRangeHelper(new Uint8List.transferable(3)); 172 testSetRangeHelper(new Uint8List.transferable(3));
173 testSetRangeHelper(new Uint8ClampedList(3)); 173 testSetRangeHelper(new Uint8ClampedList(3));
174 testSetRangeHelper(new Uint8ClampedList.transferable(3)); 174 testSetRangeHelper(new Uint8ClampedList.transferable(3));
175 } 175 }
176 176
177 void testIndexOutOfRangeHelper(typed_data) { 177 void testIndexOutOfRangeHelper(typed_data) {
178 List<int> list = const [0, 1, 2, 3]; 178 List<int> list = const [0, 1, 2, 3];
179 179
180 Expect.throws(() { 180 Expect.throws(() {
181 typed_data.setRange(0, 4, list); 181 typed_data.setRange(0, 4, list);
182 }); 182 });
183 183
184 Expect.throws(() { 184 Expect.throws(() {
185 typed_data.setRange(3, 1, list); 185 typed_data.setRange(3, 4, list);
186 }); 186 });
187 } 187 }
188 188
189 void testIndexOutOfRange() { 189 void testIndexOutOfRange() {
190 testIndexOutOfRangeHelper(new Uint8List(3)); 190 testIndexOutOfRangeHelper(new Uint8List(3));
191 testIndexOutOfRangeHelper(new Uint8List.transferable(3)); 191 testIndexOutOfRangeHelper(new Uint8List.transferable(3));
192 testIndexOutOfRangeHelper(new Uint8ClampedList(3)); 192 testIndexOutOfRangeHelper(new Uint8ClampedList(3));
193 testIndexOutOfRangeHelper(new Uint8ClampedList.transferable(3)); 193 testIndexOutOfRangeHelper(new Uint8ClampedList.transferable(3));
194 } 194 }
195 195
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 testGetAtIndex(float64list, 1.4260258159703532e-105); 393 testGetAtIndex(float64list, 1.4260258159703532e-105);
394 } 394 }
395 testTypedDataRange(true); 395 testTypedDataRange(true);
396 testUnsignedTypedDataRange(true); 396 testUnsignedTypedDataRange(true);
397 testExternalClampedUnsignedTypedDataRange(true); 397 testExternalClampedUnsignedTypedDataRange(true);
398 testViewCreation(); 398 testViewCreation();
399 testWhere(); 399 testWhere();
400 testCreationFromList(); 400 testCreationFromList();
401 } 401 }
402 402
OLDNEW
« no previous file with comments | « tests/standalone/io/web_socket_protocol_processor_test.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698