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

Unified 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: Add test for mixing int and double lists. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/typeddata/typeddata.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/typed_data_test.dart
diff --git a/tests/standalone/typed_data_test.dart b/tests/standalone/typed_data_test.dart
index 3745914b02c89c38c8b77e2e09581dd0cebf0cdf..62c4425c4be2e1864255371320452070bef551e9 100644
--- a/tests/standalone/typed_data_test.dart
+++ b/tests/standalone/typed_data_test.dart
@@ -314,6 +314,31 @@ testWhere() {
Expect.equals(5, bytes.where((v) => v > 0).length);
}
+testCreationFromList() {
+ var intList =
+ [-10000000000000000000, -255, -127, 0, 128, 256, 1000000000000000000000];
+ var intLists = [];
+ intLists.add(new Int8List.fromList(intList));
+ intLists.add(new Int16List.fromList(intList));
+ intLists.add(new Int32List.fromList(intList));
+ intLists.add(new Int64List.fromList(intList));
+ intLists.add(new Uint8List.fromList(intList));
+ intLists.add(new Uint16List.fromList(intList));
+ intLists.add(new Uint32List.fromList(intList));
+ intLists.add(new Uint64List.fromList(intList));
+ var doubleList =
+ [-123123123123.123123123123, -123.0, 0.0, 123.0, 123123123123.123123123];
+ var doubleLists = [];
+ doubleLists.add(new Float32List.fromList(doubleList));
+ doubleLists.add(new Float64List.fromList(doubleList));
+ for (var ints in intLists) {
+ for (var doubles in doubleLists) {
+ Expect.throws(() => ints[0] = doubles[0]);
+ Expect.throws(() => doubles[0] = ints[0]);
+ }
+ }
+}
+
main() {
for (int i = 0; i < 2000; i++) {
testCreateUint8TypedData();
@@ -372,5 +397,6 @@ main() {
testExternalClampedUnsignedTypedDataRange(true);
testViewCreation();
testWhere();
+ testCreationFromList();
}
« no previous file with comments | « sdk/lib/typeddata/typeddata.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698