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 | 7 |
8 main() { | 8 main() { |
9 testOperations(); | 9 testOperations(); |
10 } | 10 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 testOp((i) => i.lastWhere((n) => n < 5), "lastWhere<5"); | 99 testOp((i) => i.lastWhere((n) => n < 5), "lastWhere<5"); |
100 testOp((i) => i.lastWhere((n) => n < 10), "lastWhere<10"); | 100 testOp((i) => i.lastWhere((n) => n < 10), "lastWhere<10"); |
101 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5"); | 101 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5"); |
102 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); | 102 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); |
103 testOp((i) => i.contains(5), "contains(5)"); | 103 testOp((i) => i.contains(5), "contains(5)"); |
104 testOp((i) => i.contains(10), "contains(10)"); | 104 testOp((i) => i.contains(10), "contains(10)"); |
105 testOp((i) => i.any((n) => n < 5), "any<5"); | 105 testOp((i) => i.any((n) => n < 5), "any<5"); |
106 testOp((i) => i.any((n) => n < 10), "any<10"); | 106 testOp((i) => i.any((n) => n < 10), "any<10"); |
107 testOp((i) => i.every((n) => n < 5), "every<5"); | 107 testOp((i) => i.every((n) => n < 5), "every<5"); |
108 testOp((i) => i.every((n) => n < 10), "every<10"); | 108 testOp((i) => i.every((n) => n < 10), "every<10"); |
109 testOp((i) => i.max(), "max"); | 109 testOp((i) => i.reduce((a, b) => a + b), "reduce-sum"); |
110 testOp((i) => i.min(), "min"); | |
111 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum"); | |
112 testOp((i) => i.fold(0, (a, b) => a + b), "fold-sum"); | 110 testOp((i) => i.fold(0, (a, b) => a + b), "fold-sum"); |
113 testOp((i) => i.join("-"), "join-"); | 111 testOp((i) => i.join("-"), "join-"); |
114 testOp((i) => i.join(""), "join"); | 112 testOp((i) => i.join(""), "join"); |
115 testOp((i) => i.join(), "join-null"); | 113 testOp((i) => i.join(), "join-null"); |
116 testOp((i) => i.map((n) => n * 2), "map*2"); | 114 testOp((i) => i.map((n) => n * 2), "map*2"); |
117 testOp((i) => i.where((n) => n < 5), "where<5"); | 115 testOp((i) => i.where((n) => n < 5), "where<5"); |
118 testOp((i) => i.where((n) => n < 10), "where<10"); | 116 testOp((i) => i.where((n) => n < 10), "where<10"); |
119 testOp((i) => i.expand((n) => []), "expand[]"); | 117 testOp((i) => i.expand((n) => []), "expand[]"); |
120 testOp((i) => i.expand((n) => [n]), "expand[n]"); | 118 testOp((i) => i.expand((n) => [n]), "expand[n]"); |
121 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]"); | 119 testOp((i) => i.expand((n) => [n, n]), "expand[n, n]"); |
122 } | 120 } |
123 | 121 |
124 // Combinations of lists with 0, 1 and more elements. | 122 // Combinations of lists with 0, 1 and more elements. |
125 testList([]); | 123 testList([]); |
126 testList([0]); | 124 testList([0]); |
127 testList([10]); | 125 testList([10]); |
128 testList([0, 1]); | 126 testList([0, 1]); |
129 testList([0, 10]); | 127 testList([0, 10]); |
130 testList([10, 11]); | 128 testList([10, 11]); |
131 testList([0, 5, 10]); | 129 testList([0, 5, 10]); |
132 testList([10, 5, 0]); | 130 testList([10, 5, 0]); |
133 testList([0, 1, 2, 3]); | 131 testList([0, 1, 2, 3]); |
134 testList([3, 4, 5, 6]); | 132 testList([3, 4, 5, 6]); |
135 testList([10, 11, 12, 13]); | 133 testList([10, 11, 12, 13]); |
136 | 134 |
137 // Reverse const list. | 135 // Reverse const list. |
138 Expect.listEquals(r, l.reversed.toList()); | 136 Expect.listEquals(r, l.reversed.toList()); |
139 } | 137 } |
OLD | NEW |