| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 Iterable<num> numIter = numList.where((x) => true); | 422 Iterable<num> numIter = numList.where((x) => true); |
| 423 Set<int> set3 = setFrom(numIter); | 423 Set<int> set3 = setFrom(numIter); |
| 424 Expect.listEquals(numList, set3.toList()..sort()); | 424 Expect.listEquals(numList, set3.toList()..sort()); |
| 425 | 425 |
| 426 Set<int> set4 = setFrom(new Iterable.generate(0)); | 426 Set<int> set4 = setFrom(new Iterable.generate(0)); |
| 427 Expect.isTrue(set4.isEmpty); | 427 Expect.isTrue(set4.isEmpty); |
| 428 } | 428 } |
| 429 | 429 |
| 430 void testCESetFrom(setFrom) { | 430 void testCESetFrom(setFrom) { |
| 431 List<Object> ceList = [new CE(2), new CE(3), new CE(5), | 431 var ceList = [new CE(2), new CE(3), new CE(5), |
| 432 new CE(7), new CE(11), new CE(13)]; | 432 new CE(7), new CE(11), new CE(13)]; |
| 433 | 433 |
| 434 Set<CE> set1 = setFrom(ceList); | 434 Set<CE> set1 = setFrom(ceList); |
| 435 Expect.listEquals(ceList, set1.toList()..sort()); | 435 Expect.listEquals(ceList, set1.toList()..sort()); |
| 436 | 436 |
| 437 Set<CE> ceSet = ceList.toSet(); | 437 Set<CE> ceSet = ceList.toSet(); |
| 438 Set<CE> set2 = setFrom(ceSet); | 438 Set<CE> set2 = setFrom(ceSet); |
| 439 Expect.listEquals(ceList, set2.toList()..sort()); | 439 Expect.listEquals(ceList, set2.toList()..sort()); |
| 440 | 440 |
| 441 Iterable<CE> ceIter = ceList.where((x) => true); | 441 Iterable<CE> ceIter = ceList.where((x) => true); |
| 442 Set<CE> set3 = setFrom(ceIter); | 442 Set<CE> set3 = setFrom(ceIter); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, | 520 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, |
| 521 customCompare(20), validKey)); | 521 customCompare(20), validKey)); |
| 522 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare)); | 522 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare)); |
| 523 | 523 |
| 524 testASetFrom((x) => new Set<A>.from(x)); | 524 testASetFrom((x) => new Set<A>.from(x)); |
| 525 testASetFrom((x) => new HashSet<A>.from(x)); | 525 testASetFrom((x) => new HashSet<A>.from(x)); |
| 526 testASetFrom((x) => new LinkedHashSet<A>.from(x)); | 526 testASetFrom((x) => new LinkedHashSet<A>.from(x)); |
| 527 testASetFrom((x) => new SplayTreeSet<A>.from(x, identityCompare)); | 527 testASetFrom((x) => new SplayTreeSet<A>.from(x, identityCompare)); |
| 528 } | 528 } |
| OLD | NEW |