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

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

Issue 339763002: Make TypedList not implement ByteBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/file_typed_data_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 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 // VMOptions=--optimization_counter_threshold=10 7 // VMOptions=--optimization_counter_threshold=10
8 8
9 // Library tag to be able to run in html test framework. 9 // Library tag to be able to run in html test framework.
10 library TypedDataTest; 10 library TypedDataTest;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 Expect.throws(() { 168 Expect.throws(() {
169 typed_data.setRange(3, 4, list); 169 typed_data.setRange(3, 4, list);
170 }); 170 });
171 171
172 Expect.throws(() { 172 Expect.throws(() {
173 typed_data[new C(-4000000)] = value; 173 typed_data[new C(-4000000)] = value;
174 }); 174 });
175 175
176 Expect.throws(() { 176 Expect.throws(() {
177 var size = typed_data.elementSizeInBytes; 177 var size = typed_data.elementSizeInBytes;
178 var i = (typed_data.length - 1) * size + 1; 178 var i = (typed_data.length - 1) * size + 1;
179 typed_data[new C(i)] = value; 179 typed_data[new C(i)] = value;
180 }); 180 });
181 181
182 Expect.throws(() { 182 Expect.throws(() {
183 typed_data[new C(-1)] = value; 183 typed_data[new C(-1)] = value;
184 }); 184 });
185 } 185 }
186 186
187 void testIndexOutOfRange() { 187 void testIndexOutOfRange() {
188 testIndexOutOfRangeHelper(new Int8List(3), 0); 188 testIndexOutOfRangeHelper(new Int8List(3), 0);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN); 295 bdata.setInt64(i, 3038287259199220266, Endianness.LITTLE_ENDIAN);
296 } 296 }
297 validate(); 297 validate();
298 for (int i = 0; i < bdata.lengthInBytes-7; i+=8) { 298 for (int i = 0; i < bdata.lengthInBytes-7; i+=8) {
299 bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN); 299 bdata.setFloat64(i, 1.4260258159703532e-105, Endianness.LITTLE_ENDIAN);
300 } 300 }
301 validate(false); 301 validate(false);
302 } 302 }
303 303
304 testViewCreation() { 304 testViewCreation() {
305 var bytes = new Uint8List(1024); 305 var bytes = new Uint8List(1024).buffer;
306 var view = new ByteData.view(bytes, 24); 306 var view = new ByteData.view(bytes, 24);
307 Expect.equals(1000, view.lengthInBytes); 307 Expect.equals(1000, view.lengthInBytes);
308 view = new Uint8List.view(bytes, 24); 308 view = new Uint8List.view(bytes, 24);
309 Expect.equals(1000, view.lengthInBytes); 309 Expect.equals(1000, view.lengthInBytes);
310 view = new Int8List.view(bytes, 24); 310 view = new Int8List.view(bytes, 24);
311 Expect.equals(1000, view.lengthInBytes); 311 Expect.equals(1000, view.lengthInBytes);
312 view = new Uint8ClampedList.view(bytes, 24); 312 view = new Uint8ClampedList.view(bytes, 24);
313 Expect.equals(1000, view.lengthInBytes); 313 Expect.equals(1000, view.lengthInBytes);
314 view = new Uint16List.view(bytes, 24); 314 view = new Uint16List.view(bytes, 24);
315 Expect.equals(1000, view.lengthInBytes); 315 Expect.equals(1000, view.lengthInBytes);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 testSetAtIndex(float64list, 1.4260258159703532e-105, true); 411 testSetAtIndex(float64list, 1.4260258159703532e-105, true);
412 testGetAtIndex(float64list, 1.4260258159703532e-105); 412 testGetAtIndex(float64list, 1.4260258159703532e-105);
413 } 413 }
414 testTypedDataRange(true); 414 testTypedDataRange(true);
415 testUnsignedTypedDataRange(true); 415 testUnsignedTypedDataRange(true);
416 testViewCreation(); 416 testViewCreation();
417 testWhere(); 417 testWhere();
418 testCreationFromList(); 418 testCreationFromList();
419 } 419 }
420 420
OLDNEW
« no previous file with comments | « tests/standalone/io/file_typed_data_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698