| OLD | NEW |
| 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 library set_test; | 5 library set_test; |
| 6 | 6 |
| 7 | 7 |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import "dart:collection"; | 9 import "dart:collection"; |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 Expect.isFalse(set.remove("not an it")); | 236 Expect.isFalse(set.remove("not an it")); |
| 237 Expect.isFalse(set.containsAll(["Not an int", "Also no an int"])); | 237 Expect.isFalse(set.containsAll(["Not an int", "Also no an int"])); |
| 238 | 238 |
| 239 testLength(4, set); | 239 testLength(4, set); |
| 240 set.removeAll(["Not an int", 999, "Also no an int"]); | 240 set.removeAll(["Not an int", 999, "Also no an int"]); |
| 241 testLength(3, set); | 241 testLength(3, set); |
| 242 set.retainAll(["Not an int", 0, "Also no an int"]); | 242 set.retainAll(["Not an int", 0, "Also no an int"]); |
| 243 testLength(1, set); | 243 testLength(1, set); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void testRetainWhere(Set create([equals, hashCode, validKey])) { | 246 void testRetainWhere(Set create([equals, hashCode, validKey, compare])) { |
| 247 // The retainWhere method must not collapse the argument Iterable | 247 // The retainWhere method must not collapse the argument Iterable |
| 248 // in a way that doesn't match the equality of the set. | 248 // in a way that doesn't match the equality of the set. |
| 249 // It must not throw away equal elements that are different in the | 249 // It must not throw away equal elements that are different in the |
| 250 // equality of the set. | 250 // equality of the set. |
| 251 // It must not consider objects to be not there if they are equal | 251 // It must not consider objects to be not there if they are equal |
| 252 // in the equality of the set. | 252 // in the equality of the set. |
| 253 | 253 |
| 254 // If set equality is natural equality, using different but equal objects | 254 // If set equality is natural equality, using different but equal objects |
| 255 // must work. Can't use an identity set internally (as was done at some point | 255 // must work. Can't use an identity set internally (as was done at some point |
| 256 // during development). | 256 // during development). |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 testDifferenceIntersection(([equals, hashCode, validKey, comparator]) => | 396 testDifferenceIntersection(([equals, hashCode, validKey, comparator]) => |
| 397 new HashSet(equals: equals, hashCode: hashCode, isValidKey: validKey)); | 397 new HashSet(equals: equals, hashCode: hashCode, isValidKey: validKey)); |
| 398 testDifferenceIntersection(([equals, hashCode, validKey, comparator]) => | 398 testDifferenceIntersection(([equals, hashCode, validKey, comparator]) => |
| 399 new LinkedHashSet(equals: equals, hashCode: hashCode, | 399 new LinkedHashSet(equals: equals, hashCode: hashCode, |
| 400 isValidKey: validKey)); | 400 isValidKey: validKey)); |
| 401 testDifferenceIntersection(([equals, hashCode, validKey, comparator]) => | 401 testDifferenceIntersection(([equals, hashCode, validKey, comparator]) => |
| 402 new SplayTreeSet(comparator, validKey)); | 402 new SplayTreeSet(comparator, validKey)); |
| 403 | 403 |
| 404 } | 404 } |
| OLD | NEW |