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

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

Issue 13834008: Add fromList constructor to typeddata typed lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« runtime/lib/typeddata.dart ('K') | « sdk/lib/typeddata/typeddata.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 // 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 view = new Float64List.view(bytes, 24); 307 view = new Float64List.view(bytes, 24);
308 Expect.equals(1000, view.lengthInBytes); 308 Expect.equals(1000, view.lengthInBytes);
309 } 309 }
310 310
311 testWhere() { 311 testWhere() {
312 var bytes = new Uint8List(13); 312 var bytes = new Uint8List(13);
313 bytes.setRange(0, 5, [1, 1, 1, 1, 1]); 313 bytes.setRange(0, 5, [1, 1, 1, 1, 1]);
314 Expect.equals(5, bytes.where((v) => v > 0).length); 314 Expect.equals(5, bytes.where((v) => v > 0).length);
315 } 315 }
316 316
317 testCreationFromList() {
318 var intList =
319 [-10000000000000000000, -255, -127, 0, 128, 256, 1000000000000000000000];
320 var list = new Int8List.fromList(intList);
321 list = new Int16List.fromList(intList);
322 list = new Int32List.fromList(intList);
323 list = new Int64List.fromList(intList);
324 list = new Uint8List.fromList(intList);
325 list = new Uint16List.fromList(intList);
326 list = new Uint32List.fromList(intList);
327 list = new Uint64List.fromList(intList);
328 var doubleList =
329 [-123123123123.123123123123, -123.0, 0.0, 123.0, 123123123123.123123123];
330 list = new Float32List.fromList(doubleList);
331 list = new Float64List.fromList(doubleList);
332 }
333
317 main() { 334 main() {
318 for (int i = 0; i < 2000; i++) { 335 for (int i = 0; i < 2000; i++) {
319 testCreateUint8TypedData(); 336 testCreateUint8TypedData();
320 testCreateClampedUint8TypedData(); 337 testCreateClampedUint8TypedData();
321 testCreateExternalClampedUint8TypedData(); 338 testCreateExternalClampedUint8TypedData();
322 testTypedDataRange(false); 339 testTypedDataRange(false);
323 testUnsignedTypedDataRange(false); 340 testUnsignedTypedDataRange(false);
324 testClampedUnsignedTypedDataRange(false); 341 testClampedUnsignedTypedDataRange(false);
325 testExternalClampedUnsignedTypedDataRange(false); 342 testExternalClampedUnsignedTypedDataRange(false);
326 testSetRange(); 343 testSetRange();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 382
366 var float64list = new Float64List(16); 383 var float64list = new Float64List(16);
367 testSetAtIndex(float64list, 1.4260258159703532e-105, true); 384 testSetAtIndex(float64list, 1.4260258159703532e-105, true);
368 testGetAtIndex(float64list, 1.4260258159703532e-105); 385 testGetAtIndex(float64list, 1.4260258159703532e-105);
369 } 386 }
370 testTypedDataRange(true); 387 testTypedDataRange(true);
371 testUnsignedTypedDataRange(true); 388 testUnsignedTypedDataRange(true);
372 testExternalClampedUnsignedTypedDataRange(true); 389 testExternalClampedUnsignedTypedDataRange(true);
373 testViewCreation(); 390 testViewCreation();
374 testWhere(); 391 testWhere();
392 testCreationFromList();
375 } 393 }
376 394
OLDNEW
« runtime/lib/typeddata.dart ('K') | « sdk/lib/typeddata/typeddata.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698