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

Side by Side Diff: tests/corelib/collection_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/corelib/collection_contains_test.dart ('k') | tests/corelib/core_runtime_types_test.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class CollectionTest { 5 class CollectionTest {
6 CollectionTest(Collection collection) { 6 CollectionTest(Collection collection) {
7 testReduce(collection); 7 testReduce(collection);
8 } 8 }
9 9
10 void testReduce(Collection collection) { 10 void testReduce(Collection collection) {
11 Expect.equals(28, collection.reduce(0, (prev, element) => prev + element)); 11 Expect.equals(28, collection.reduce(0, (prev, element) => prev + element));
12 Expect.equals( 12 Expect.equals(
13 3024, collection.reduce(1, (prev, element) => prev * element)); 13 3024, collection.reduce(1, (prev, element) => prev * element));
14 } 14 }
15 } 15 }
16 16
17 17
18 main() { 18 main() {
19 final TEST_ELEMENTS = const [4, 2, 6, 7, 9]; 19 final TEST_ELEMENTS = const [4, 2, 6, 7, 9];
20 // Const list. 20 // Const list.
21 new CollectionTest(TEST_ELEMENTS); 21 new CollectionTest(TEST_ELEMENTS);
22 22
23 // Fixed size list. 23 // Fixed size list.
24 var fixedList = new List(TEST_ELEMENTS.length); 24 var fixedList = new List.fixedLength(TEST_ELEMENTS.length);
25 for (int i = 0; i < TEST_ELEMENTS.length; i++) { 25 for (int i = 0; i < TEST_ELEMENTS.length; i++) {
26 fixedList[i] = TEST_ELEMENTS[i]; 26 fixedList[i] = TEST_ELEMENTS[i];
27 } 27 }
28 new CollectionTest(fixedList); 28 new CollectionTest(fixedList);
29 29
30 // Dynamic size list. 30 // Dynamic size list.
31 new CollectionTest(new List.from(TEST_ELEMENTS)); 31 new CollectionTest(new List.from(TEST_ELEMENTS));
32 32
33 // Dynamic size set. 33 // Dynamic size set.
34 new CollectionTest(new Set.from(TEST_ELEMENTS)); 34 new CollectionTest(new Set.from(TEST_ELEMENTS));
35 35
36 // Queue. 36 // Queue.
37 new CollectionTest(new Queue.from(TEST_ELEMENTS)); 37 new CollectionTest(new Queue.from(TEST_ELEMENTS));
38 } 38 }
OLDNEW
« no previous file with comments | « tests/corelib/collection_contains_test.dart ('k') | tests/corelib/core_runtime_types_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698