OLD | NEW |
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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 main() { | 7 main() { |
8 testOperations(); | 8 testOperations(); |
9 } | 9 } |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 testOp((i) => i.singleWhere((n) => false), "singleWhere<false"); | 107 testOp((i) => i.singleWhere((n) => false), "singleWhere<false"); |
108 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5"); | 108 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5"); |
109 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); | 109 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); |
110 testOp((i) => i.singleWhere((n) => true), "singleWhere<true"); | 110 testOp((i) => i.singleWhere((n) => true), "singleWhere<true"); |
111 testOp((i) => i.contains(5), "contains(5)"); | 111 testOp((i) => i.contains(5), "contains(5)"); |
112 testOp((i) => i.contains(10), "contains(10)"); | 112 testOp((i) => i.contains(10), "contains(10)"); |
113 testOp((i) => i.any((n) => n < 5), "any<5"); | 113 testOp((i) => i.any((n) => n < 5), "any<5"); |
114 testOp((i) => i.any((n) => n < 10), "any<10"); | 114 testOp((i) => i.any((n) => n < 10), "any<10"); |
115 testOp((i) => i.every((n) => n < 5), "every<5"); | 115 testOp((i) => i.every((n) => n < 5), "every<5"); |
116 testOp((i) => i.every((n) => n < 10), "every<10"); | 116 testOp((i) => i.every((n) => n < 10), "every<10"); |
117 testOp((i) => i.max(), "max"); | 117 testOp((i) => i.reduce((a, b) => a + b), "reduce-sum"); |
118 testOp((i) => i.min(), "min"); | |
119 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum"); | |
120 testOp((i) => i.fold(0, (a, b) => a + b), "fold-sum"); | 118 testOp((i) => i.fold(0, (a, b) => a + b), "fold-sum"); |
121 testOp((i) => i.join("-"), "join-"); | 119 testOp((i) => i.join("-"), "join-"); |
122 testOp((i) => i.join(""), "join"); | 120 testOp((i) => i.join(""), "join"); |
123 testOp((i) => i.join(), "join-null"); | 121 testOp((i) => i.join(), "join-null"); |
124 testOp((i) => i.map((n) => n * 2), "map*2"); | 122 testOp((i) => i.map((n) => n * 2), "map*2"); |
125 testOp((i) => i.where((n) => n < 5), "where<5"); | 123 testOp((i) => i.where((n) => n < 5), "where<5"); |
126 testOp((i) => i.where((n) => n < 10), "where<10"); | 124 testOp((i) => i.where((n) => n < 10), "where<10"); |
127 testOp((i) => i.expand((n) => []), "expand[]"); | 125 testOp((i) => i.expand((n) => []), "expand[]"); |
128 testOp((i) => i.expand((n) => [n]), "expand[n]"); | 126 testOp((i) => i.expand((n) => [n]), "expand[n]"); |
129 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]"); | 127 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]"); |
(...skipping 27 matching lines...) Expand all Loading... |
157 testList([0, 1, 2, 3]); | 155 testList([0, 1, 2, 3]); |
158 testList([3, 4, 5, 6]); | 156 testList([3, 4, 5, 6]); |
159 testList([10, 11, 12, 13]); | 157 testList([10, 11, 12, 13]); |
160 testList(l); | 158 testList(l); |
161 testList(r); | 159 testList(r); |
162 testList(base); | 160 testList(base); |
163 | 161 |
164 // Reverse const list. | 162 // Reverse const list. |
165 Expect.listEquals(r, l.map(rev).toList()); | 163 Expect.listEquals(r, l.map(rev).toList()); |
166 } | 164 } |
OLD | NEW |