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

Side by Side Diff: tests/corelib/list_reversed_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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5"); 99 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5");
100 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); 100 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10");
101 testOp((i) => i.contains(5), "contains(5)"); 101 testOp((i) => i.contains(5), "contains(5)");
102 testOp((i) => i.contains(10), "contains(10)"); 102 testOp((i) => i.contains(10), "contains(10)");
103 testOp((i) => i.any((n) => n < 5), "any<5"); 103 testOp((i) => i.any((n) => n < 5), "any<5");
104 testOp((i) => i.any((n) => n < 10), "any<10"); 104 testOp((i) => i.any((n) => n < 10), "any<10");
105 testOp((i) => i.every((n) => n < 5), "every<5"); 105 testOp((i) => i.every((n) => n < 5), "every<5");
106 testOp((i) => i.every((n) => n < 10), "every<10"); 106 testOp((i) => i.every((n) => n < 10), "every<10");
107 testOp((i) => i.max(), "max"); 107 testOp((i) => i.max(), "max");
108 testOp((i) => i.min(), "min"); 108 testOp((i) => i.min(), "min");
109 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum"); 109 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum");
Lasse Reichstein Nielsen 2013/04/04 08:35:18 Remove reduce.
floitsch 2013/04/05 16:10:03 ditto: I prefer getting an error, that I need to u
110 testOp((i) => i.fold(0, (a, b) => a + b), "fold-sum");
110 testOp((i) => i.join("-"), "join-"); 111 testOp((i) => i.join("-"), "join-");
111 testOp((i) => i.join(""), "join"); 112 testOp((i) => i.join(""), "join");
112 testOp((i) => i.join(), "join-null"); 113 testOp((i) => i.join(), "join-null");
113 testOp((i) => i.map((n) => n * 2), "map*2"); 114 testOp((i) => i.map((n) => n * 2), "map*2");
114 testOp((i) => i.where((n) => n < 5), "where<5"); 115 testOp((i) => i.where((n) => n < 5), "where<5");
115 testOp((i) => i.where((n) => n < 10), "where<10"); 116 testOp((i) => i.where((n) => n < 10), "where<10");
116 testOp((i) => i.expand((n) => []), "expand[]"); 117 testOp((i) => i.expand((n) => []), "expand[]");
117 testOp((i) => i.expand((n) => [n]), "expand[n]"); 118 testOp((i) => i.expand((n) => [n]), "expand[n]");
118 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]"); 119 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]");
119 } 120 }
120 121
121 // Combinations of lists with 0, 1 and more elements. 122 // Combinations of lists with 0, 1 and more elements.
122 testList([]); 123 testList([]);
123 testList([0]); 124 testList([0]);
124 testList([10]); 125 testList([10]);
125 testList([0, 1]); 126 testList([0, 1]);
126 testList([0, 10]); 127 testList([0, 10]);
127 testList([10, 11]); 128 testList([10, 11]);
128 testList([0, 5, 10]); 129 testList([0, 5, 10]);
129 testList([10, 5, 0]); 130 testList([10, 5, 0]);
130 testList([0, 1, 2, 3]); 131 testList([0, 1, 2, 3]);
131 testList([3, 4, 5, 6]); 132 testList([3, 4, 5, 6]);
132 testList([10, 11, 12, 13]); 133 testList([10, 11, 12, 13]);
133 134
134 // Reverse const list. 135 // Reverse const list.
135 Expect.listEquals(r, l.reversed.toList()); 136 Expect.listEquals(r, l.reversed.toList());
136 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698