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

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

Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 5
6 main() { 6 main() {
7 testOperations(); 7 testOperations();
8 } 8 }
9 9
10 class ThrowMarker { 10 class ThrowMarker {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); 108 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10");
109 testOp((i) => i.singleWhere((n) => true), "singleWhere<true"); 109 testOp((i) => i.singleWhere((n) => true), "singleWhere<true");
110 testOp((i) => i.contains(5), "contains(5)"); 110 testOp((i) => i.contains(5), "contains(5)");
111 testOp((i) => i.contains(10), "contains(10)"); 111 testOp((i) => i.contains(10), "contains(10)");
112 testOp((i) => i.any((n) => n < 5), "any<5"); 112 testOp((i) => i.any((n) => n < 5), "any<5");
113 testOp((i) => i.any((n) => n < 10), "any<10"); 113 testOp((i) => i.any((n) => n < 10), "any<10");
114 testOp((i) => i.every((n) => n < 5), "every<5"); 114 testOp((i) => i.every((n) => n < 5), "every<5");
115 testOp((i) => i.every((n) => n < 10), "every<10"); 115 testOp((i) => i.every((n) => n < 10), "every<10");
116 testOp((i) => i.max(), "max"); 116 testOp((i) => i.max(), "max");
117 testOp((i) => i.min(), "min"); 117 testOp((i) => i.min(), "min");
118 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum"); 118 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum");
Lasse Reichstein Nielsen 2013/04/04 08:35:18 Remove the reduce line. It's deprecated.
floitsch 2013/04/05 16:10:03 I prefer keeping it. When I change the reduce to t
119 testOp((i) => i.fold(0, (a, b) => a + b), "fold-sum");
119 testOp((i) => i.join("-"), "join-"); 120 testOp((i) => i.join("-"), "join-");
120 testOp((i) => i.join(""), "join"); 121 testOp((i) => i.join(""), "join");
121 testOp((i) => i.join(), "join-null"); 122 testOp((i) => i.join(), "join-null");
122 testOp((i) => i.map((n) => n * 2), "map*2"); 123 testOp((i) => i.map((n) => n * 2), "map*2");
123 testOp((i) => i.where((n) => n < 5), "where<5"); 124 testOp((i) => i.where((n) => n < 5), "where<5");
124 testOp((i) => i.where((n) => n < 10), "where<10"); 125 testOp((i) => i.where((n) => n < 10), "where<10");
125 testOp((i) => i.expand((n) => []), "expand[]"); 126 testOp((i) => i.expand((n) => []), "expand[]");
126 testOp((i) => i.expand((n) => [n]), "expand[n]"); 127 testOp((i) => i.expand((n) => [n]), "expand[n]");
127 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]"); 128 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]");
128 testOp((i) => i.take(0), "take(0)"); 129 testOp((i) => i.take(0), "take(0)");
(...skipping 26 matching lines...) Expand all
155 testList([0, 1, 2, 3]); 156 testList([0, 1, 2, 3]);
156 testList([3, 4, 5, 6]); 157 testList([3, 4, 5, 6]);
157 testList([10, 11, 12, 13]); 158 testList([10, 11, 12, 13]);
158 testList(l); 159 testList(l);
159 testList(r); 160 testList(r);
160 testList(base); 161 testList(base);
161 162
162 // Reverse const list. 163 // Reverse const list.
163 Expect.listEquals(r, l.map(rev).toList()); 164 Expect.listEquals(r, l.map(rev).toList());
164 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698