| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 Expect.isTrue(set4.isEmpty); | 426 Expect.isTrue(set4.isEmpty); |
| 427 } | 427 } |
| 428 | 428 |
| 429 void testCESetFrom(setFrom) { | 429 void testCESetFrom(setFrom) { |
| 430 List<Object> ceList = [new CE(2), new CE(3), new CE(5), | 430 List<Object> ceList = [new CE(2), new CE(3), new CE(5), |
| 431 new CE(7), new CE(11), new CE(13)]; | 431 new CE(7), new CE(11), new CE(13)]; |
| 432 | 432 |
| 433 Set<CE> set1 = setFrom(ceList); | 433 Set<CE> set1 = setFrom(ceList); |
| 434 Expect.listEquals(ceList, set1.toList()..sort()); | 434 Expect.listEquals(ceList, set1.toList()..sort()); |
| 435 | 435 |
| 436 Set<ce> ceSet = ceList.toSet(); | 436 Set<CE> ceSet = ceList.toSet(); |
| 437 Set<CE> set2 = setFrom(ceSet); | 437 Set<CE> set2 = setFrom(ceSet); |
| 438 Expect.listEquals(ceList, set2.toList()..sort()); | 438 Expect.listEquals(ceList, set2.toList()..sort()); |
| 439 | 439 |
| 440 Iterable<ce> ceIter = ceList.where((x) => true); | 440 Iterable<CE> ceIter = ceList.where((x) => true); |
| 441 Set<CE> set3 = setFrom(ceIter); | 441 Set<CE> set3 = setFrom(ceIter); |
| 442 Expect.listEquals(ceList, set3.toList()..sort()); | 442 Expect.listEquals(ceList, set3.toList()..sort()); |
| 443 | 443 |
| 444 Set<CE> set4 = setFrom(new Iterable.generate(0)); | 444 Set<CE> set4 = setFrom(new Iterable.generate(0)); |
| 445 Expect.isTrue(set4.isEmpty); | 445 Expect.isTrue(set4.isEmpty); |
| 446 } | 446 } |
| 447 | 447 |
| 448 main() { | 448 main() { |
| 449 testMain(() => new HashSet()); | 449 testMain(() => new HashSet()); |
| 450 testMain(() => new LinkedHashSet()); | 450 testMain(() => new LinkedHashSet()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 502 |
| 503 testCESetFrom((x) => new Set<CE>.from(x)); | 503 testCESetFrom((x) => new Set<CE>.from(x)); |
| 504 testCESetFrom((x) => new HashSet<CE>.from(x)); | 504 testCESetFrom((x) => new HashSet<CE>.from(x)); |
| 505 testCESetFrom((x) => new LinkedHashSet<CE>.from(x)); | 505 testCESetFrom((x) => new LinkedHashSet<CE>.from(x)); |
| 506 testCESetFrom((x) => new SplayTreeSet<CE>.from(x)); | 506 testCESetFrom((x) => new SplayTreeSet<CE>.from(x)); |
| 507 | 507 |
| 508 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, | 508 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, |
| 509 customCompare(20), validKey)); | 509 customCompare(20), validKey)); |
| 510 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare)); | 510 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare)); |
| 511 } | 511 } |
| OLD | NEW |